The Messenger of Allah ﷺ said, "Whoever prays for Allah for forty days in congregation, catching the first takbir, two exemptions are recorded for him, exemption from the Fire and exemption from hypocrisy."
حدثنا عقبة بن مكرم ونصر بن علي الجهضمي قالا حدثنا أبو قتيبة سلم بن قتيبة عن طعمة بن عمرو عن حبيب بن أبي ثابت
قال رسول الله ﷺ من صلى لله أربعين يوما في جماعة يدرك التكبيرة الأولى كتبت له براءتان براءة من النار وبراءة من النفاق
No references are available.
[Its isnad is daif]. Mizzi reported it in Tahzib Kamal (9/232) from the hadith of Nasr bin Ali Jahdami, through him. Habib is a mudallis narrator and used the ambiguous form "an." There is another daif route for it found in Bahshal Wasiti's Tarikh Wasit (p. 62), and the hadith has daif supporting narrations found in Ahmad (1553) and others.