Imām Bukhārī narrates: Qutaibah narrated to us, he said: Yazīd ibn Zurai' narrated to us, from Sulaimān al-Taimī, from Abī 'Uthmān al-Nahdī, from Ibn Mas'ūd, may Allāh be pleased with him, that:
a person kissed a woman, then he came into the presence of the Prophet ﷺ and informed him of it. Then Allāh, Mighty and Glorious, revealed this verse: "And establish prayer at the two ends of the day, and in the early hours of the night. Indeed, good deeds erase bad deeds." (Hūd: ). That person asked: O Messenger of Allāh! Is this ruling only for me (or is it for the whole ummah)? He said: It is for my whole ummah.
حَدَّثَنَا قُتَيْبَةُ، قَالَ حَدَّثَنَا يَزِيدُ بْنُ زُرَيْعٍ، عَنْ سُلَيْمَانَ التَّيْمِيِّ، عَنْ أَبِي عُثْمَانَ النَّهْدِيِّ، عَنِ ابْنِ مَسْعُودٍ، أَنَّ رَجُلاً، أَصَابَ مِنَ امْرَأَةٍ قُبْلَةً، فَأَتَى النَّبِيَّ صلى الله عليه وسلم فَأَخْبَرَهُ، فَأَنْزَلَ اللَّهُ {أَقِمِ الصَّلاَةَ طَرَفَىِ النَّهَارِ وَزُلَفًا مِنَ اللَّيْلِ إِنَّ الْحَسَنَاتِ يُذْهِبْنَ السَّيِّئَاتِ}. فَقَالَ الرَّجُلُ يَا رَسُولَ اللَّهِ أَلِي هَذَا قَالَ " لِجَمِيعِ أُمَّتِي كُلِّهِمْ ".
Reference: Sahih Al Bukhari 526