He instructed a man that when he lay down to sleep he should say, "O Allah, You created my soul and You take it in death. To You belong its death and its life. If You keep it alive, then protect it, and if You cause it to die, then 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 ﷺ."
حدثنا محمد بن جعفر حدثنا شعبة عن خالد حدثنا عبد الله بن الحارث
أنه أمر رجلا إذا أخذ مضجعه قال اللهم إنك خلقت نفسي وأنت توفاها لك مماتها ومحياها إن أحييتها فاحفظها وإن أمتها فاغفر لها اللهم أسألك العافية فقال له رجل سمعت هذا من عمر فقال من خير من عمر رضي الله عنه من رسول الله ﷺ
Its isnad is sahih. Khalid is Ibn Hazzaa. Abdullah bin Harith is Ansari, whose reliability was established earlier at 2138. The hadith was reported by Muslim, 2:315, via Ghundar, who is Muhammad bin Jafar, from Shubah, with this same isnad. "Better than Umar" in M reads "from one who is better than Umar," and what appears here is confirmed in a manuscript with a marginal note.