I asked the Prophet ﷺ, "Which sin is greatest in the sight of Allah?"He replied, "That you set up a rival to Allah, when He created you."I said, "That is indeed grave. 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 narrated it in the tafsir chapter (4477), and Muslim in the faith chapter (86), both from Uthman bin Abu Shayba, who said, Jareer narrated to us, from Mansur, from Abu Waail, from Amr bin Shurahbil, from Abdullah, and he mentioned it, and their wordings are identical.