Abu Ibrahim al-Ash’hali reported: When the Messenger of Allah, peace and blessings be upon him, performed the funeral prayer, he would say, “O Allah, forgive our living and our deceased, those of us present and those of us absent, our young and our old, our males and our females.”
In another narration, the Prophet said, “O Allah, for whomever you give life among us, give him life upon Islam. For whomever you take among us, take him upon faith.”
Source: Sunan al-Tirmidhī 1024
Grade: Sahih (authentic) according to Al-Tirmidhi
عن أبي إِبْرَاهِيم الْأَشْهَلِيّ قَالَ كَانَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِذَا صَلَّى عَلَى الْجَنَازَةِ قَالَ اللَّهُمَّ اغْفِرْ لِحَيِّنَا وَمَيِّتِنَا وَشَاهِدِنَا وَغَائِبِنَا وَصَغِيرِنَا وَكَبِيرِنَا وَذَكَرِنَا وَأُنْثَانَا
وفي رواية أخرى قال اللَّهُمَّ مَنْ أَحْيَيْتَهُ مِنَّا فَأَحْيِهِ عَلَى الْإِسْلَامِ وَمَنْ تَوَفَّيْتَهُ مِنَّا فَتَوَفَّهُ عَلَى الْإِيمَانِ
1024 سنن الترمذي كتاب الجنائز باب ما يقول في الصلاة على الميت
1024 المحدث الترمذي خلاصة حكم المحدث حسن صحيح في سنن الترمذي