A man came to the Prophet ﷺ and said, "Messenger of Allah, I have done everything with a woman except that I did not have intercourse with her."So Allah revealed, "Establish prayer at the two ends of the day and during parts of the night. Indeed, good deeds do away with misdeeds" [Hud 11:114].
حدثنا الحسن بن يحيى من أهل مرو حدثنا الفضل بن موسى عن سفيان الثوري عن سماك عن إبراهيم عن عبد الرحمن بن يزيد
جاء رجل إلى النبي ﷺ فقال يا رسول الله إني أصبت من امرأة كل شيء إلا أني لم أجامعها قال فأنزل الله {أقم الصلاة طرفي النهار وزلفا من الليل إن الحسنات يذهبن السيئات}
Its isnad is sahih. Hasan bin Yahya Marwazi is discussed in Tajil 96, where Husayni said, "There is something questionable about him," and Ibn Hajar mentioned that he is discussed in Tarikh Baghdad by Ibn Najjar, and that no criticism was mentioned there. This man is one of Ahmad's teachers, and Ahmad was careful in choosing his teachers, so he is trustworthy, Allah willing. Al-Hafiz mentioned in this same entry another narrator named Hasan bin Yahya Marwazi, then wondered whether they were one person or two. They are in fact two, without doubt. Ahmad's teacher narrates from Ibn Mubarak, while the other one is one of Ibn Mubarak's teachers, and narrates from Ikrima and from Kathir bin Ziyad. He has an entry in Tarikh al-Kabir by Bukhari, 1/2/207, and in Tahdhib, 2:325–326. The hadith is similar in meaning to 3653.