Sahih al-Bukhari 7488
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
يَا فُلاَنُ إِذَا أَوَيْتَ إِلَى فِرَاشِكَ فَقُلِ اللَّهُمَّ أَسْلَمْتُ نَفْسِي إِلَيْكَ، وَوَجَّهْتُ وَجْهِي إِلَيْكَ وَفَوَّضْتُ أَمْرِي إِلَيْكَ، وَأَلْجَأْتُ ظَهْرِي إِلَيْكَ، رَغْبَةً وَرَهْبَةً إِلَيْكَ، لاَ مَلْجَأَ وَلاَ مَنْجَا مِنْكَ إِلاَّ إِلَيْكَ، آمَنْتُ بِكِتَابِكَ الَّذِي أَنْزَلْتَ، وَبِنَبِيِّكَ الَّذِي أَرْسَلْتَ. فَإِنَّكَ إِنْ مُتَّ فِي لَيْلَتِكَ مُتَّ عَلَى الْفِطْرَةِ، وَإِنْ أَصْبَحْتَ أَصَبْتَ أَجْرًا "
Narrated Al-Bara' bin `Azib:
Allah's Messenger (ﷺ) said, "O so-and-so, whenever you go to your bed (for sleeping) say, 'O Allah! I have surrendered myself over to you and have turned my face towards You, and leave all my affairs to You and depend on You and put my trust in You expecting Your reward and fearing Your punishment. There is neither fleeing from You nor refuge but with You. I believe in the Book (Qur'an) which You have revealed and in Your Prophet (Muhammad) whom You have sent.' If you then die on that night, then you will die as a Muslim, and if you wake alive in the morning then you will receive the reward." (See Hadith No. 323, Vol. 8)
Full reference and source
Sahih al-Bukhari 7488 In-book : Book 97, Hadith 114 USC-MSA web (English) : Vol. 9, Book 93, Hadith 580 (deprecated)
View source on Sunnah.com (opens in a new tab)