عَنِ الْبَرَاءِ بْنِ عَازِبٍ رَضِيَ اللَّهُ عَنْهُ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ أَمَرَ رَجُلًا مِنَ الْأَنْصَارِ أَنْ يَقُولَ إِذَا أَخَذَ مَضْجَعَهُ اللَّهُمَّ أَسْلَمْتُ نَفْسِي إِلَيْكَ وَوَجَّهْتُ وَجْهِي إِلَيْكَ وَفَوَّضْتُ أَمْرِي إِلَيْكَ وَأَلْجَأْتُ ظَهْرِي إِلَيْكَ رَغْبَةً وَرَهْبَةً إِلَيْكَ لَا مَلْجَأَ وَلَا مَنْجَى مِنْكَ إِلَّا إِلَيْكَ آمَنْتُ بِكِتَابِكَ الَّذِي أَنْزَلْتَ وَنَبِيِّكَ الَّذِي أَرْسَلْتَ فَإِنْ مَاتَ مَاتَ عَلَى الْفِطْرَةِ
It is narrated from Sayyiduna Bara’ bin Azib (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) instructed an Ansari man that when he comes to his bed, he should recite this supplication: “O Allah! I have submitted my soul to You, I have turned my face towards You, I have entrusted my affairs to You, and I have leaned my back upon You, out of desire and fear towards You. There is no refuge and no escape from You except to You. I have believed in Your Book which You have revealed, and in Your Prophet whom You have sent.” Then the Prophet (peace and blessings be upon him) said: If he dies that night, he will die upon the natural faith.