عَنْ عَبْدِ اللَّهِ بْنِ الْحَارِثِ عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ رَضِيَ اللَّهُ عَنْهُمَا أَنَّهُ أَمَرَ رَجُلًا إِذَا أَخَذَ مَضْجَعَهُ قَالَ اللَّهُمَّ إِنَّكَ خَلَقْتَ نَفْسِي وَأَنْتَ تَوَفَّاهَا لَكَ مَمَاتُهَا وَمَحْيَاهَا إِنْ أَحْيَيْتَهَا فَاحْفَظْهَا وَإِنْ أَمَتَّهَا فَاغْفِرْ لَهَا اللَّهُمَّ أَسْأَلُكَ الْعَافِيَةَ فَقَالَ لَهُ رَجُلٌ سَمِعْتَ هَذَا مِنْ عُمَرَ فَقَالَ مِنْ خَيْرٍ مِنْ عُمَرَ رَضِيَ اللَّهُ عَنْهُ مِنْ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ
It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that he instructed a man that when he comes to his bed to sleep, he should recite this supplication: "O Allah! Indeed, You created my soul and You will take it back... O Allah! I ask You for well-being." (O Allah! Surely, You created my soul and You alone will cause it to die; its death and life are for You. 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.)