Sayyiduna Yazid bin al-Aswad (may Allah be pleased with him) said: I was present with the Messenger of Allah (peace and blessings be upon him) for his Hajj, and I prayed the Fajr prayer with him in Masjid al-Khayf. When he (peace and blessings be upon him) had finished the prayer, he saw two men sitting at the back of the mosque who had not prayed with him (peace and blessings be upon him). He (peace and blessings be upon him) said: "Bring them to me." They were brought to him (peace and blessings be upon him), their bodies trembling with fear and alarm. He (peace and blessings be upon him) said: "Why did you not pray with us?" They said: O Messenger of Allah! We had prayed at our homes. He (peace and blessings be upon him) said: "Do not do so. When you have prayed at home and then come to the mosque while the congregation is praying, pray with them; it will be a voluntary prayer for you."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3644