Abu Dharr reported,

The Prophet ﷺ said, "When a man prays with the imam until he finishes, it is recorded for him as having spent the night in prayer."

Azami 4649

Sahih

عن أبي ذر

عن النبي ﷺ قال: إن الرجل إذا صلى مع الإمام حتى ينصرف حسب له قيام ليلة.

الأعظمي 4649صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Fasting
Chapter
Night prayer in Ramadan
Section
Whoever prays with the imam until he leaves, it is counted for him as praying the whole night
Numbering
Jami al-Kamil 4649 (2nd edition)
Azami 4649