It is narrated from Sayyiduna Anas (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When you come to the prayer, you must keep to calm (and dignity); so whatever part you catch (with the imam), pray it, and whatever you miss, complete it."
This hadith has a supporting narration (shahid) in the Sahih from the hadith of Sayyiduna Abu Qatadah (may Allah be pleased with him) and Sayyiduna Abu Hurayrah (may Allah be pleased with him).