Someone asked, "Messenger of Allah, can one of us sleep while in a state of major ritual impurity?"He replied, "Yes, if he performs ablution."
أخبرنا عبيد الله بن سعيد قال حدثنا يحيى عن عبيد الله قال أخبرني نافع عن عبد الله بن عمر أن
يا رسول الله أينام أحدنا وهو جنب قال إذا توضأ
Muslim narrated it in the chapter on Menstruation, in the section on the permissibility of a person in a state of major impurity sleeping and the recommendation of wudu for him, etc., hadith no. 306, from the hadith of Yahya Qattan.Bukhari narrated it in the chapter on ghusl, in the section on a person in a state of major impurity performing wudu then sleeping, hadith no. 289, from the hadith of Nafi, with the same wording.