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."
أن النبي ﷺ كان إذا أخذ مضجعه قال: اللهم باسمك أحيا وباسمك أموت. وإذا استيقظ قال: الحمد لله الذى أحيانا بعد ما أماتنا وإليه النشور.
Muslim narrated it in the Book of Remembrance and Supplication (2711) from Ubaydullah bin Muaz, who said, my father narrated to us, who said, Shuba narrated to us, from Abdullah bin Abu Safar, from Abu Bakr bin Abu Musa, from Bara, who mentioned it.