It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that a man asked him about the funeral prayer, and he said: "Then you send blessings upon the Prophet (peace and blessings be upon him), then you supplicate: 'Allahumma abduka fulan, aw amatuka fulanah, kana ya'buduka la yushriku bika shay'a, in kana muhsinan fa-zidhu fi ihsanihi, wa in kana musi'an fa-tajawaz anhu, Allahumma la tahrimna ajrahu wa la taftinna ba'dahu' (O Allah! This is Your servant so-and-so, or Your female servant so-and-so, who used to worship You and did not associate anything with You. If he was a doer of good, then increase his good deeds; and if he was a sinner, then overlook him. O Allah! Do not deprive us of his reward, and do not put us to trial after him)."
Imam Musaddad recorded it with a chain all of whose narrators are thiqat (trustworthy). Imam Abu Ya'la, and Imam Ibn Hibban in his Sahih, also recorded it with the wording that whenever Sayyiduna Abu Hurayrah (may Allah be pleased with him) prayed over a deceased person, he would supplicate: 'Allahumma abduka wa ibnu abdika kana yashhadu an la ilaha illa anta wa anna Muhammadan abduka wa rasuluka, wa anta a'lamu bihi, in kana muhsinan fa-zid fi ihsanihi, wa in kana musi'an faghfir lahu, wa la tahrimna ajrahu wa la taftinna ba'dahu' (O Allah! This is Your servant and the son of Your servant. He used to bear witness that there is no deity worthy of worship except You and that Muhammad (peace and blessings be upon him) is Your servant and Messenger, and You know his state better. If he was a doer of good, then increase his good deeds; and if he was a sinner, then forgive him. Do not deprive us of his reward, and do not put us to trial after him). Imam Malik recorded in al-Muwatta' through the route of Sa'id bin Abi Sa'id that he asked Sayyiduna Abu Hurayrah (may Allah be pleased with him): How do you pray the funeral prayer? Sayyiduna Abu Hurayrah (may Allah be pleased with him) replied: "By your life, I will certainly tell you. I walk with the funeral from the home of its family; then, when the deceased is placed (for the prayer), I proclaim the greatness of Allah (say the takbir), praise Allah Almighty and send blessings upon His Prophet (peace and blessings be upon him); then I say: 'O Allah! Your servant'" Then he mentioned the supplication that is in Imam Abu Ya'la's narration.