It was narrated that ‘Abdullah bin Abi Qais said:
“I asked ‘Aishah: ‘How did the Messenger of Allah (ﷺ) sleep while he was Junub? Did he perform Ghusl before sleeping or sleep before performing Ghusl?’ She said: ‘He did both. Sometimes he would perform Ghusl then sleep, and sometimes he would perform Wudu’ then sleep.'”
[Sunan An Nasai Book 4 Hadith 9]