Bara bin Azib reported,

The Prophet ﷺ said to a man, "When you lie down to sleep or retire to your bed, say, 'O Allah, I submit my face to You, I entrust my back to You, and I commit my affair to You, in hope of You and in fear of You. There is no refuge or escape from You except to You. I believe in Your Book which You revealed and in Your Prophet whom You sent.' If you die that night, you will die upon the natural disposition of faith, and if you wake in the morning, you will have attained much good."

Ibn Majah 3876

Sahih

حدثنا علي بن محمد حدثنا وكيع حدثنا سفيان عن أبي إسحق

عن البراء بن عازب

أن النبي ﷺ قال لرجل إذا أخذت مضجعك أو أويت إلى فراشك فقل اللهم أسلمت وجهي إليك وألجأت ظهري إليك وفوضت أمري إليك رغبة ورهبة إليك لا ملجأ ولا منجأ منك إلا إليك آمنت بكتابك الذي أنزلت ونبيك الذي أرسلت فإن مت من ليلتك مت على الفطرة وإن أصبحت أصبحت وقد أصبت خيرا كثيرا

ابن ماجه 3876صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Supplication
Chapter
What to say when going to bed
Numbering
Darussalam 3876
Ibn Majah 3876