‘A’isha reported the Prophet as saying, "If a company of Muslims to the number of a hundred pray over a dead person, all of them interceding for him, their intercession for him will be accepted.”
Kuraib the client of Ibn ‘Abbas told that a son of ‘Abdallah b. ‘Abbas died in Qudaid or ‘Usfan and he asked him to go out and see how many people had gathered for the funeral. Going out and finding that people had gathered for the funeral, he told him. Ibn ‘Abbas asked him if he thought there would be forty present, and when he replied that that was so, he gave orders for the body to be brought out, adding that he had heard God’s messenger say, "If any Muslim man dies and forty men who associate nothing with God stand over his bier, God will accept them as intercessors for him.”
Anas told that when some people passed a dead body on a bier and spoke highly of the dead man the Prophet said, “It is certain.” When they passed another and spoke very badly of the dead man he said, “It is certain.” ‘Umar asked what was certain, and he replied, “You spoke highly of this one, so paradise is certain for him; but you spoke very badly of that one, so hell is certain for him. You are God’s witnesses in the earth.”
(Bukhari and Muslim.) A version has “The believers are God's witnesses in the earth.”
Abu Huraira said that a negress (or a youth) used to sweep the mosque. God’s messenger missed her, and when he asked about her (or him) the people told him he had died. He asked why they had not informed him, and it appeared as if they had treated her (or him) as of little account. He asked the people to lead him to the grave, and when they did so he prayed over her (The wording of this tradition causes some difficulty owing to the indefiniteness as to whether the person was a man or a woman. Sometimes the alternative is mentioned, as in the translation, but sometimes merely the masculine singular pronoun and at others merely the feminine singular pronoun is used) and then said, "These graves are full of darkness for their occupants, but God will illuminate them for them by reason of my prayer over them.”