Sunan Abi Dawud, Book 1, Hadith 221 (USC-MSA) ⓘ
‘Abd Allah b. ‘Umar reported : ‘Umar b. al-Khattab said to the Messenger of Allah (May peace be upon him) that he became sexually defiled at night (asking him what he should do). The Messenger of Allah (May peace be upon him) said : You should perform ablution and wash your penis and then sleep.
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ، عَنْ مَالِكٍ، عَنْ عَبْدِ اللَّهِ بْنِ دِينَارٍ، عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ، أَنَّهُ قَالَ ذَكَرَ عُمَرُ بْنُ الْخَطَّابِ لِرَسُولِ اللَّهِ صلى الله عليه وسلم أَنَّهُ تُصِيبُهُ الْجَنَابَةُ مِنَ اللَّيْلِ فَقَالَ لَهُ رَسُولُ اللَّهِ صلى الله عليه وسلم " تَوَضَّأْ وَاغْسِلْ ذَكَرَكَ ثُمَّ نَمْ " .
also referenced under: Hadith 221 (DarusSalam) & Hadith 221 (Hasan)