Al-Bara' bin 'Azib (May Allah be pleased with them) reported: The Messenger of Allah ﷺ said, "Whenever you intend to go to bed, perform Wudu' as is done for Salat (prayer); and then lie down on the right side and recite: 'Allahumma aslamtu nafsi ilaika, wa fawwadtu amri ilaika, wal-ja'tu zahri ilaika, raghbatan wa rahbatan ilaika, la malja'a wa la manja minka illa ilaika, amantu bikitabik-alladhi anzalta, wa binabiyyik-alladhi arsalta O Allah! I have submitted myself to You. I have turned my face to You, entrusted my affairs to You and relied completely on You out of desire for and fear of You (expecting Your reward and fearing Your punishment). There is no resort and no deliverer from (hardships) except You. I affirm my faith in Your Book which You have revealed, and in Your Prophet whom You have sent'. If you die during the night, you will die in the true religion. Let these words be your last words at night". Al- Bukhari and Muslim.