He said, I asked the Prophet ﷺ, "Which sin is greatest before Allah?"He replied, "That you set up a rival to Allah, when He is the One who created you."I said, "That is indeed tremendous. Then which?"He said, "That you kill your child out of fear that he will eat with you."I asked, "Then which?"He said, "That you commit adultery with your neighbor's wife."
قال سألت النبي ﷺ أي الذنب أعظم عند الله؟ قال: أن تجعل الله ندا وهو خلقك قلت: إن ذلك لعظيم، قلت: ثم أي؟ قال: وأن تقتل ولدك تخاف أن يطعم معك قلت: ثم أي؟ قال: أن تزاني حليلة جارك.
Bukhari reported it in the tafsir (4477), and Muslim in the Faith (86), both of them from Uthman bin Abu Shayba, who said, Jareer narrated to us from Mansur, from Abu Waail, from Amr bin Shurahbil, from Abdullah, who said, and then he mentioned it. The wording given is that of Bukhari, and the wording of Muslim is similar.