What is to be said at the time of Sleeping
Al-Bara bin Azib (radi Allahu anhu) said, the Messenger of Allah (sal Allahu alaihi wa sallam) directed me this: “Whenever you go to bed, perform Wudu as you do for Salat then (before sleeping) recite: ‘O Allah! I have submitted myself to You, I have turned myself to You, committed my affairs to You and sought Your refuge for protection out of desire for You and fear of You (expecting Your reward and fearing Your punishment). There is no refuge and no place of safety from You but with You. I believe in the Book You have revealed and in the Prophet (sal Allahu alaihi wa sallam) You have sent.”’ The Messenger of Allah (sal Allahu alaihi wa sallam) added: “If anyone recites these words and dies during the night, he will die on the true Deen, and if he remains alive till the morning, he will obtain good. And make this supplication your last words (before sleeping).”
[Sahih Al-Bukhari and Muslim]
Before going to bed, a believer revives his commitment to Faith, Islam and Allah by reciting this prayer (supplication) of the Messenger of Allah (sal Allahu alaihi wa sallam).
Through this practice, every night he is able to remember Allah and His Commandments amidst the activities of the day time.
And Allah knows best!