Sayyiduna Abdullah bin Amr (may Allah be pleased with him) reports this saying of the Prophet (peace and blessings be upon him): "There are six kinds of gatherings in which the believer has a guarantee from Allah Almighty, whichever of these gatherings he is in: a congregational mosque, beside a sick person, or at a funeral, or in his own house, or with a just ruler whom that believer honours and respects."
Al-Tabarani recorded it in al-Mu'jam al-Kabir, and al-Bazzar recorded something similar; its narrators have been deemed trustworthy (muwaththaq).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الصلاة / 2034