Sunan an Nasai 1940
The Book of Funerals
أَخْبَرَنَا قُتَيْبَةُ، قَالَ حَدَّثَنَا عَبْثَرٌ، عَنْ بُرْدٍ، أَخِي يَزِيدَ بْنِ أَبِي زِيَادٍ عَنِ الْمُسَيَّبِ بْنِ رَافِعٍ، قَالَ سَمِعْتُ الْبَرَاءَ بْنَ عَازِبٍ، يَقُولُ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " مَنْ تَبِعَ جَنَازَةً حَتَّى يُصَلَّى عَلَيْهَا كَانَ لَهُ مِنَ الأَجْرِ قِيرَاطٌ وَمَنْ مَشَى مَعَ الْجَنَازَةِ حَتَّى تُدْفَنَ كَانَ لَهُ مِنَ الأَجْرِ قِيرَاطَانِ وَالْقِيرَاطُ مِثْلُ أُحُدٍ " .
It was narrated that Al-Musayyab bin Rafi' said:"I heard Al-Bara' bin 'Azib say: The Messenger of Allah said: 'whoever follows a Janazah until the prayer is offered, he will have one Qirat of reward and whoever walks with the funeral until (the body) is buried will have two Qirats of reward, and a Qirat is like Uhud
Grading: Abu Ghuddah: Sahih · Al-Albani: Sahih · Zubair Ali Zai: Isnaad Sahih
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.