Sayyiduna Abu Hurayrah (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "Whoever attends a funeral until the funeral prayer is offered over it will have one qirat (of reward), and whoever attends it until it is buried will have two qirats." It was asked: What are the two qirats? He said: "Like two great mountains."
Salim bin Abdullah bin Umar narrates that Abdullah bin Umar (may Allah be pleased with them both) used to pray over a funeral and then leave; but when the hadith of Abu Hurayrah (may Allah be pleased with him) reached him, he said: "We have lost many qirats."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 6745