When the Prophet ﷺ wanted to sleep while in a state of major ritual impurity, he would perform ablution as he did for prayer.
حدثنا سفيان أخبرنا الزهري عن أبي سلمة
أن النبي ﷺ كان إذا أراد أن ينام وهو جنب توضأ وضوءه للصلاة
Its isnad is sahih. Bukhari narrated it, 1/393, no. 882, in Fath al-Bari, in the chapter on ghusl, and Muslim, 1/248, no. 305, in the chapter on menstruation, and Ibn Majah, 1/193, no. 584, and Ibn Khuzayma, 1/107, no. 213.