(a) Sayyiduna Yazid bin Amir (may Allah be pleased with him) said: When I came, the Prophet (peace and blessings be upon him) was praying. I sat down and did not join him (peace and blessings be upon him) in the prayer. When he (peace and blessings be upon him) finished the prayer, he saw me sitting. He (peace and blessings be upon him) said: "Yazid! Are you not a Muslim?" I replied: Certainly, O Messenger of Allah! I am a Muslim. He (peace and blessings be upon him) said: "Why did you not join the people in their prayer?" I said: I had prayed at home, and I thought that you would already have prayed. He (peace and blessings be upon him) said: "When you come to the mosque and find the people praying, pray with them, even if you have already prayed. Let that (earlier prayer) be voluntary for you, and this one obligatory."
(b) This hadith agrees with what has passed regarding repeating the prayer when one finds the congregation, but it differs from it as to which of the two is the obligatory one; what has passed is more numerous and better known, so it takes precedence. And Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3647
Dawud bin Abi Hind (may Allah have mercy on him) said: I asked Sa'id bin al-Musayyib (may Allah have mercy on him) about a man who prays in his house and then also finds the congregation. He said: He should pray with the congregation as well. I said: For which of the two prayers will he receive the reward of the obligatory prayer? He said: For the one he prayed in congregation, because Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrated to us that the Messenger of Allah (peace and blessings be upon him) said: "Prayer in congregation is (in reward) twenty-five times greater than the prayer of one praying alone."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3648