Mishkat al-Masabih 1660
وَعَنْ كُرَيْبٍ مَوْلَى ابْنِ عَبَّاسٍ عَنْ عَبْدِ اللَّهِ بْنِ عَبَّاسٍ أَنَّهُ مَاتَ لَهُ ابْنٌ بِقُدَيْدٍ أَوْ بِعُسْفَانَ فَقَالَ: يَا كُرَيْبُ انْظُرْ مَا اجْتَمَعَ لَهُ مِنَ النَّاسِ قَالَ: فَخَرَجْتُ فَإِذَا نَاسٌ قَدِ اجْتَمَعُوا لَهُ فَأَخْبَرْتُهُ فَقَالَ: تَقُولُ: هُمْ أَرْبَعُونَ؟ قَالَ: نَعَمْ. قَالَ: أَخْرِجُوهُ فَإِنِّي سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ: «مَا مِنْ رَجُلٍ مُسْلِمٍ يَمُوتُ فَيَقُومُ عَلَى جَنَازَتِهِ أَرْبَعُونَ رَجُلًا لَا يُشْرِكُونَ بِاللَّهِ شَيْئًا إِلَّا شَفَّعَهُمُ اللَّهُ فِيهِ» . رَوَاهُ مُسلم
From Kurayb, the freed slave of Ibn ʿAbbas, from ʿAbdullah ibn ʿAbbas: A son of his died at Qudayd or at ʿUsfan, and he said: "O Kurayb, see how many people have gathered for him." He said: I went out, and people had gathered for him, and I informed him. He said: "Would you say they are forty?" He said: "Yes." He said: "Bring him out, for I heard the Messenger of Allah ﷺ say: 'There is no Muslim man who dies and forty men who do not associate anything with Allah stand [in prayer] over his funeral, except that Allah accepts their intercession for him.'" Reported by Muslim.