Abdullah bin Umar reported,

He instructed a man that when he lay down to sleep, he should say, "O Allah, You created my soul and You will take it. To You belong its death and its life. If You keep it alive, protect it, and if You cause it to die, forgive it. O Allah, I ask You for well-being."A man said to him, "Did you hear this from Umar?"He replied, "From one better than Umar, from the Messenger of Allah ﷺ."

Azami 11237

Sahih

عن عبد الله بن عمر

أنه أمر رجلا إذا أخذ مضجعه قال: اللهم خلقت نفسي وأنت توفاها، لك مماتها ومحياها، إن أحييتها فاحفظها، وإن أمتها فاغفر لها، اللهم إني أسألك العافية. فقال له رجل: أسمعت هذا من عمر؟ فقال: من خير من عمر، من رسول الله ﷺ.

الأعظمي 11237صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Morning and evening supplications
Section
Supplications and remembrances narrated when going to sleep and when waking up
Numbering
Jami al-Kamil 11237 (2nd edition)
Azami 11237