Abu 'Abdur-Rahman 'Auf bin Malik (May Allah be pleased with him) reported:
The Messenger of Allah (ﷺ) offered a funeral prayer and I memorized his supplication. He (ﷺ) prayed: "Allahummaghfir lahu, warhamhu, wa 'afihi, wa'fu 'anhu, wa akrim nuzulahu, wa wassi' mudkhalahu, waghsilhu bil-ma'i wath-thalji wal-baradi, wa naqqihi minal-khataya, kama naqqaytath-thawbal-abyada minad-danasi, wa abdilhu daran khairan min darihi, wa ahlan khairan min ahlihi, wa zawjan khairan min zawjihi, wa adkhilhul-Jannata, wa a'idh-hu min 'adhabil- qabri, wa min 'adhabin-nar [if the dead person is a woman, one should change the ending of certain words in this supplication from hu to ha] (O Allah! Forgive him, bestow mercy upon him, pardon him, accord him a noble provision and make his grave spacious, wash him with water, snow and hail, purify him from sins as You have purified the white garment from soiling, give him a better abode in place of his present one, and a better family in exchange of his present one, and a better spouse in place of his present wife; admit him to Jannah and protect from the trial in the grave and punishment in the Hell)." (After hearing this supplication of the Messenger of Allah (ﷺ), Abu' Abdur-Rahman 'Auf bin Malik (May Allah be pleased with him) said: I wished I had been that dead man.[Muslim].
App reference: Book 7, Hadith 41
Arabic/English book reference: Book 7, Hadith 935