Abdullah bin Masud reported,

A man took liberties with a woman, meaning something short of fornication. I do not know exactly how far it went, only that it was less than zina. He came to the Prophet ﷺ and told him about it, and Allah, glorified is He, revealed, "Establish prayer at the two ends of the day and in the early hours of the night. Indeed, good deeds wipe away evil deeds. That is a reminder for those who remember" [Hud 11:114].The man asked, "Messenger of Allah, is this for me?"He replied, "It is for whoever acts upon it."

Ibn Majah 1398

Sahih

حدثنا سفيان بن وكيع حدثنا إسمعيل ابن علية عن سليمان التيمي عن أبي عثمان النهدي

عن عبد الله بن مسعود

أن رجلا أصاب من امرأة يعني ما دون الفاحشة فلا أدري ما بلغ غير أنه دون الزنا فأتى النبي ﷺ فذكر ذلك له فأنزل الله سبحانه {أقم الصلاة طرفي النهار وزلفا من الليل إن الحسنات يذهبن السيئات ذلك ذكرى للذاكرين} فقال يا رسول الله ألي هذه قال لمن أخذ بها

ابن ماجه 1398صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Establishing prayer and the sunnah regarding it
Chapter
Prayer is an expiation
Numbering
Darussalam 1398
Ibn Majah 1398