The Messenger of Allah ﷺ said, "Whoever follows the funeral procession of a Muslim out of faith and seeking reward, remaining with it until the prayer is performed and the burial is completed, will return with two qirats of reward, each qirat being like Mount Uhud. And whoever prays over it and then returns before the burial will come back with one qirat."Uthman the muezzin followed him in narrating this. He said, Awf narrated to us from Muhammad, from Abu Hurairah, from the Prophet ﷺ, something similar.
حدثنا أحمد بن عبد الله بن علي المنجوفي قال حدثنا روح قال حدثنا عوف عن الحسن ومحمد
أن رسول الله ﷺ قال من اتبع جنازة مسلم إيمانا واحتسابا وكان معه حتى يصلى عليها ويفرغ من دفنها فإنه يرجع من الأجر بقيراطين كل قيراط مثل أحد ومن صلى عليها ثم رجع قبل أن تدفن فإنه يرجع بقيراط تابعه عثمان المؤذن قال حدثنا عوف عن محمد عن أبي هريرة عن النبي ﷺ نحوه