4 – Book on the Etiquette of Sleeping, Lying Down, Sitting, Gatherings, Companions, and Dreams
127 – Chapter: What one says when going to sleep
818 – Al-Barāʾ ibn ʿĀzib (may Allah be pleased with them both) said: When the Messenger of Allah ﷺ retired to his bed, he would lie on his right side and then say, “O Allah, I have submitted my soul to You, turned my face toward You, entrusted my affairs to You, and placed my back in Your care, in hope of You and in fear of You. There is no refuge and no escape from You except with You. I believe in Your Book which You have revealed and in Your Prophet whom You have sent.” Al-Bukhārī narrated it with this wording in the Book of Manners of his Ṣaḥīḥ. (1)
819 – Al-Barāʾ also reported that the Messenger of Allah ﷺ said to him, “When you go to your bed, perform ablution as you do for prayer, then lie on your right side and say …” — he mentioned words similar to the previous supplication, adding — “and make these the last words you utter.” Agreed upon. (2)
820 – ʿĀʾishah (may Allah be pleased with her) said: The Prophet ﷺ used to pray eleven rakʿahs during the night. When dawn approached, he would pray two brief rakʿahs, then lie on his right side until the muʾadhdhin came to inform him that it was time. Agreed upon. (3)