Sahih al Bukhari 290
Bathing (Ghusl)
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يُوسُفَ، قَالَ أَخْبَرَنَا مَالِكٌ، عَنْ عَبْدِ اللَّهِ بْنِ دِينَارٍ، عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ، أَنَّهُ قَالَ ذَكَرَ عُمَرُ بْنُ الْخَطَّابِ لِرَسُولِ اللَّهِ صلى الله عليه وسلم أَنَّهُ تُصِيبُهُ الْجَنَابَةُ مِنَ اللَّيْلِ، فَقَالَ لَهُ رَسُولُ اللَّهِ صلى الله عليه وسلم " تَوَضَّأْ وَاغْسِلْ ذَكَرَكَ ثُمَّ نَمْ ".
Narrated `Abdullah bin `Umar:`Umar bin Al-Khattab told Allah's Messenger (ﷺ), "I became Junub at night." Allah's Messenger (ﷺ) replied, "Perform ablution after washing your private parts and then sleep
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.