Kurayb reported,

Abdullah bin Abbas reported that a son of his died at Qudayd, or perhaps at Usfan. He said, "Kurayb, see how many people have gathered for him."Kurayb said, So I went out, and there were people who had gathered for him, and I informed him.He asked, "Do 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 who dies and forty men who associate nothing with Allah stand over his funeral but that Allah accepts their intercession for him.'"

Ahmad 2509

Sahih

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

عن كريب مولى ابن عباس

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

أحمد 2509صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Abdullah bin Abbas bin Abdul-Muttalib
Numbering
Darussalam 2509
Ahmad 2509