Abdullah bin Abbas reported,

A son of his died at Qudayd, or perhaps at Usfan. He said, "Kurayb, see how many people have gathered for him."Kurayb said, I went out and found that people had gathered for him, so I informed him.He asked, "Would you say they are forty?"I replied, "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 associate nothing with Allah, stand in prayer over his funeral, except that Allah accepts their intercession for him.'"In the narration of Ibn Maruf, from Sharik bin Ubayy Numayr, from Kurayb, from Ibn Abbas.

Muslim 2199

Sahih

حدثنا هارون بن معروف وهارون بن سعيد الأيلي والوليد بن شجاع السكوني قال الوليد حدثني وقال الآخران حدثنا ابن وهب أخبرني أبو صخر عن شريك بن عبد الله بن أبي نمر عن كريب مولى ابن عباس

عن عبد الله بن عباس

أنه مات ابن له بقديد أو بعسفان فقال يا كريب انظر ما اجتمع له من الناس قال فخرجت فإذا ناس قد اجتمعوا له فأخبرته فقال تقول هم أربعون قال نعم قال أخرجوه فإني سمعت رسول الله ﷺ يقول ما من رجل مسلم يموت فيقوم على جنازته أربعون رجلا لا يشركون بالله شيئا إلا شفعهم الله فيه وفي رواية ابن معروف عن شريك بن أبي نمر عن كريب عن ابن عباس

مسلم 2199صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Funerals
Chapter
Whoever has forty pray over him, they will intercede for him
Numbering
Darussalam 2199
Muslim 2199