Al-Bara’ ibn ‘Azib reported: The Messenger of Allah, peace and blessings be upon him, said, “When you go to sleep, perform ablution as for your prayer, then lie down on your right side and say: O Allah, I submit my face to You, I entrust my affair to You, and I commit myself to You, in hope and in fear of You. There is no refuge or place of safety but with You. I believe in the Book You have revealed, and in the Prophet You have sent.“ Then, the Prophet said, “Make these your last words. If you died in this night of yours, you will have died upon pure nature.”
Source: Ṣaḥīḥ al-Bukhārī 6311, Ṣaḥīḥ Muslim 2710
Grade: Muttafaqun Alayhi (authenticity agreed upon) according to Al-Bukhari and Muslim
عن البراء بن عازب أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ إِذَا أَخَذْتَ مَضْجَعَكَ فَتَوَضَّأْ وُضُوءَكَ لِلصَّلاَةِ ثُمَّ اضْطَجِعْ عَلَى شِقِّكَ الأَيْمَنِ ثُمَّ قُلِ اللَّهُمَّ إِنِّي أَسْلَمْتُ وَجْهِي إِلَيْكَ وَفَوَّضْتُ أَمْرِي إِلَيْكَ وَأَلْجَأْتُ ظَهْرِي إِلَيْكَ رَغْبَةً وَرَهْبَةً إِلَيْكَ لاَ مَلْجَأَ وَلاَ مَنْجَا مِنْكَ إِلاَّ إِلَيْكَ آمَنْتُ بِكِتَابِكَ الَّذِي أَنْزَلْتَ وَبِنَبِيِّكَ الَّذِي أَرْسَلْتَ ثم قال وَاجْعَلْهُنَّ مِنْ آخِرِ كَلاَمِكَ فَإِنْ مُتَّ مِنْ لَيْلَتِكَ مُتَّ وَأَنْتَ عَلَى الْفِطْرَةِ
6311 صحيح البخاري كتاب الدعوات باب إذا بات طاهرا وفضله
صحيح مسلم كتاب الذكر والدعاء والتوبة والاستغفار باب ما يقول عند النوم وأخذ المضجع 2710