It is narrated from Sayyiduna Umar (may Allah be pleased with him) that he asked the Messenger of Allah (peace and blessings be upon him), "Can any one of us sleep in a state of janabah (major ritual impurity)?" The Prophet (peace and blessings be upon him) said: "He can sleep, and if he wishes, he may perform ablution."
Hadith Referenceصحيح ابن خزيمه / جماع أبواب فضول التطهير والاستحباب من غير إيجاب / 211
It is narrated from Sayyiduna Ibn Umar (may Allah be pleased with them both) that Sayyiduna Umar (may Allah be pleased with him) asked the Messenger of Allah (peace and blessings be upon him), "Can any one of us sleep in a state of janabah (major ritual impurity)?" The Prophet (peace and blessings be upon him) said: "When he intends to sleep, he should perform ablution."
Hadith Referenceصحيح ابن خزيمه / جماع أبواب فضول التطهير والاستحباب من غير إيجاب / 212