Whenever the Messenger of Allah ﷺ prayed over a funeral, he would say, "O Allah, forgive our living and our dead, those present among us and those absent, our young and our old, our males and our females."Yahya said, Abu Salama bin Abdul-Rahman narrated to me from Abu Hurairah, from the Prophet ﷺ, the like of that, and he added in it, "O Allah, whoever You keep alive among us, keep him alive upon Islam, and whoever You cause to die among us, cause him to die upon faith."
حدثنا علي بن حجر أخبرنا هقل بن زياد حدثنا الأوزاعي عن يحيى بن أبي كثير حدثني
كان رسول الله ﷺ إذا صلى على الجنازة قال اللهم اغفر لحينا وميتنا وشاهدنا وغائبنا وصغيرنا وكبيرنا وذكرنا وأنثانا قال يحيى وحدثني أبو سلمة بن عبد الرحمن عن أبي هريرة عن النبي ﷺ مثل ذلك وزاد فيه اللهم من أحييته منا فأحيه على الإسلام ومن توفيته منا فتوفه على الإيمان
[Sahih]. Nasai also recorded it in Kubra, no. 10923, and in Amal al-Yawm wal-Layla, no. 1084, from the hadith of Uzai with the same chain, and its chain is hasan. The hadith has other routes with Abu Dawud, no. 3201, and Ahmad, 5/299, 198, and others, and Ibn Jarud graded it sahih, no. 541.There is also a narration on this subject from Abdul-Rahman bin Awf [Bazzar (Bahr Zakhkhar: 3/254, no. 1545)], Ayesha [Bayhaqi: 4/41 and Hakim: 1/358], Abu Qatada [Ahmad: 4/170 and Nasai in Amal al-Yawm wal-Layla, no. 1086], Jabir [Ahmad: 3/357 and Ibn Majah, no. 1501], and Awf bin Malik [coming up: 1025].