Almost identical passages can be found in Qiddushin 30b, Qohlet Rabba 5.10.2, Midrash Yetsirat ha-Walad vol. 1, p. 156, 18ff. in Jellinek’s Beth ha-Midrasch.