Whenever the Prophet (ﷺ) intended to sleep while he was Junub, he used to wash his private parts and perform ablution like that for the prayer.
Sahih al-Bukhari Book 5, Hadith 40