Abu Hurairah reported,

The Prophet ﷺ said, "O Allah, this is Your servant and the son of Your servant. He used to testify that there is no god but You and that Muhammad is Your servant and Messenger, and You know him best. If he was a doer of good, increase him in his good deeds, and if he was a wrongdoer, forgive him. Do not deprive us of his reward, and do not lead us astray after him."

Azami 3714

Sahih

عن أبي هريرة

عن النبي ﷺ قال: اللهم عبدك وابن عبدك، كان يشهد أن لا إله إلا أنت وأن محمدا عبدك ورسولك وأنت أعلم به، إن كان محسنا فزده في إحسانه، وإن كان مسيئا فاغفر له، ولا تحرمنا أجره ولا تفتنا بعده.

الأعظمي 3714صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Prayer over the deceased
Section
Supplications over the funeral
Numbering
Jami al-Kamil 3714 (2nd edition)
Azami 3714