Bara bin Azib reported,

The Prophet ﷺ, when he lay down to sleep, would say, "O Allah, in Your name I live and in Your name I die." And when he woke, he would say, "Praise be to Allah who has given us life after causing us to die, and to Him is the resurrection."

Azami 11236

Sahih

عن البراء

أن النبي ﷺ كان إذا أخذ مضجعه قال: اللهم باسمك أحيا وباسمك أموت. وإذا استيقظ قال: الحمد لله الذى أحيانا بعد ما أماتنا وإليه النشور.

الأعظمي 11236صحيح
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 11236 (2nd edition)
Azami 11236