Hadithcore
Hadith #2117680

Ibn Mas'ud (RAA) narrated, ‘l asked the Messenger of Allah (ﷺ) “Which sin is the most serious?” He replied, attribute a partner to Allah, though He Alone has created you. “I asked, “What next?” He said, kill your child, fearing that he will share your food with you.” I asked again, “What next?” He said, “To commit adultery with your neighbor’s wife.” Agreed upon.

وَعَنْ اِبْنِ مَسْعُودٍ ‏- رضى الله عنه ‏- قَالَ سَأَلْتُ رَسُولَ اَللَّهِ ‏- صلى الله عليه وسلم ‏-أَيُّ اَلذَّنْبِ أَعْظَمُ? قَالَ: { أَنْ تَجْعَلَ لِلَّهِ نِدًّا, وَهُوَ خَلَقَكَ.‏ قُلْتُ ثُمَّ أَيُّ? قَالَ: ثُمَّ أَنْ تَقْتُلَ وَلَدَكَ خَشْيَةَ أَنْ يَأْكُلَ مَعَكَ.‏ قُلْتُ: ثُمَّ أَيُّ? قَالَ: ثُمَّ أَنْ تُزَانِيَ حَلِيلَةَ جَارِكَ } مُتَّفَقٌ عَلَيْهِ .‏ [1]‏ .‏

References2 variants
Sunnah.com reference
Book 16, Hadith 23
Arabic/English book reference
Book 16, Hadith 1502