The Messenger of Allah ﷺ said, "Whoever attends a funeral until the prayer is performed over it earns one qirat of reward, and whoever stays until the burial is complete earns two qirats."Someone asked, "Messenger of Allah, what are the two qirats?"He replied, "Like two mighty mountains."
أخبرنا سويد قال أخبرنا عبد الله عن يونس عن الزهري قال أنبأنا عبد الرحمن الأعرج
قال رسول الله ﷺ من شهد جنازة حتى يصلى عليها فله قيراط ومن شهد حتى تدفن فله قيراطان قيل وما القيراطان يا رسول الله قال مثل الجبلين العظيمين
Bukhari narrated it, Funerals, chapter on one who waits until the burial is completed, hadith 1325, and Muslim, Funerals, chapter on the merit of praying over the funeral and following it, hadith 945, from the hadith of Yunus bin Yazid Ayli, with the same wording. It is also in Al-Kubra, hadith 2122.