Sahih Muslim 948
Sahih Muslim · Book 11: The Book of Prayer - Funerals · If forty people pray for a person, they will intercede for him
'Abdullah b. 'Abbas reported that his son died in Qudaid or 'Usfan. He said to Kuraib to see as to how many people had gathered there for his (funeral). He (Kuraib) said:
حَدَّثَنَا هَارُونُ بْنُ مَعْرُوفٍ ، وَهَارُونُ بْنُ سَعِيدٍ الأَيْلِيُّ ، وَالْوَلِيدُ بْنُ شُجَاعٍ السَّكُونِيُّ ، قَالَ الْوَلِيدُ حَدَّثَنِي وَقَالَ الآخَرَانِ، حَدَّثَنَا ابْنُ وَهْبٍ ، أَخْبَرَنِي أَبُو صَخْرٍ ، عَنْ شَرِيكِ بْنِ عَبْدِ، اللَّهِ بْنِ أَبِي نَمِرٍ عَنْ كُرَيْبٍ ، مَوْلَى ابْنِ عَبَّاسٍ عَنْ عَبْدِ اللَّهِ بْنِ عَبَّاسٍ ، أَنَّهُ مَاتَ ابْنٌ لَهُ بِقُدَيْدٍ أَوْ بِعُسْفَانَ فَقَالَ يَا كُرَيْبُ انْظُرْ مَا اجْتَمَعَ لَهُ مِنَ النَّاسِ . قَالَ فَخَرَجْتُ فَإِذَا نَاسٌ قَدِ اجْتَمَعُوا لَهُ فَأَخْبَرْتُهُ فَقَالَ تَقُولُ هُمْ أَرْبَعُونَ قَالَ نَعَمْ . قَالَ أَخْرِجُوهُ فَإِنِّي سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ " مَا مِنْ رَجُلٍ مُسْلِمٍ يَمُوتُ فَيَقُومُ عَلَى جَنَازَتِهِ أَرْبَعُونَ رَجُلاً لاَ يُشْرِكُونَ بِاللَّهِ شَيْئًا إِلاَّ شَفَّعَهُمُ اللَّهُ فِيهِ " . وَفِي رِوَايَةِ ابْنِ مَعْرُوفٍ عَنْ شَرِيكِ بْنِ أَبِي نَمِرٍ عَنْ كُرَيْبٍ عَنِ ابْنِ عَبَّاسٍ .
So I went out and I informed him about the people who had gathered there. He (Ibn 'Abbas) said: Do you think they are forty? He (Kuraib) said: Yes. Ibn 'Abbas then said to them: Bring him (the dead body) out for I have heard Allah's Messenger (ﷺ) as saying: If any Muslim dies and forty men who associate nothing with Allah stand over his prayer (they offer prayer over him), Allah will accept them as intercessors for him.