Sunan an-Nasa'i, Volume 3, Book 21, Hadith 1999 (DarusSalam)

It was narrated that Abu Hurairah said: "The Messenger of Allah said: 'Whoever follows a funeral and offers the funeral prayer then leaves, will have one Qirat reward. And whoever follows it and offers the funeral prayer then stays until the burial is completed will have two Qirat of reward, both of which are greater than Uhud."

أَخْبَرَنَا الْحَسَنُ بْنُ قَزَعَةَ، قَالَ حَدَّثَنَا مَسْلَمَةُ بْنُ عَلْقَمَةَ، قَالَ أَنْبَأَنَا دَاوُدُ، عَنْ عَامِرٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ مَنْ تَبِعَ جَنَازَةً فَصَلَّى عَلَيْهَا ثُمَّ انْصَرَفَ فَلَهُ قِيرَاطٌ مِنَ الأَجْرِ وَمَنْ تَبِعَهَا فَصَلَّى عَلَيْهَا ثُمَّ قَعَدَ حَتَّى يُفْرَغَ مِنْ دَفْنِهَا فَلَهُ قِيرَاطَانِ مِنَ الأَجْرِ كُلُّ وَاحِدٍ مِنْهُمَا أَعْظَمُ مِنْ أُحُدٍ ‏" ‏ ‏.‏

sunnah.com