(6) باب جَوَازِ نَوْمِ الْجُنُبِ وَاسْتِحْبَابِ الْوُضُوءِ لَهُ وَغَسْلِ الْفَرْجِ إِذَا أَرَادَ أَنْ يَأْكُلَ أَوْ يَشْرَبَ أَوْ يَنَامَ أَوْ يُجَامِعَل
Ibn 'Umar said:
'Umar asked the verdict of the Shari'ah from the Apostle (ﷺ) thus: Is it permissible for any one of us to sleep in a state of impurity? He (the Prophet said: Yes, he must perform ablution and then sleep and take a bath when he desires.
Reference: Sahih Muslim 306 b
In-book reference: Book 3, Hadith 25
USC-MSA web (English) reference(deprecated numbering scheme): Book 3, Hadith 601