Riyad as-Salihin, Book 7, Hadith 935 (In-Book)

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].

عن أبي عبد الرحمن بن عوف بن مالك رضي الله عنه قال‏:‏ صلى رسول الله صلى الله عليه وسلم علي جنازة، فحفظت من دعائه وهو يقول‏:‏ ‏"‏اللهم اغفر له، وارحمه، وعافه، واعف عنه، وأكرم نزله، ووسع مدخله واغسله بالماء والثلج والبرد ونقه من الخطايا، كما نقيت الثوب الأبيض من الدنس، وأبدله داراً خيراً من داره، وأهلاً خيراً من أهله، وزوجاً خيراً من زوجه، وأدخله الجنة، وأعذه من عذاب القبر، ومن عذاب النار” حتي تمنين أن أكون ذلك الميت‏.‏ ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏

sunnah.com