All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Ibn ‘Abbaas narrated that the Messenger of Allaah, sallallaahu ‘alayhi wa sallam, said, “Any Muslim who dies and forty men who do not associate anything with Allaah (in worship) perform his funeral prayer, Allaah Makes them intercede for him.” [Muslim]
‘Aa’ishah narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said: “Any person who dies and the funeral prayer is performed for him by a community of Muslims reaching one hundred, who intercede (supplicate) for him, their intercession for him is accepted.” [Muslim]
In his explanation of Sunan At-Tirmithi, Al-Mubaarakfoori , may the Mercy of Allaah be upon him, said: These Hadeeths indicate the recommendation of increasing the number of the congregation of a funeral prayer. Such number is one of the causes to win Paradise. However, it must meet two conditions:
The first: that they intercede for him; meaning that they must be sincere in terms of supplicating Allaah to Forgive him.
The second: that they are Muslims including no one who associates any thing with Allaah in worship.
Allaah Knows best.