The Prophet (ﷺ) said, "The Imam is (appointed) to be followed. So do not differ from him…

Sahih al-Bukhari Book 10 Hadith 116

Sahih al-Bukhari #722

Call to Prayers (Adhaan) 10:116

Narrated Abu Huraira:

The Prophet (ﷺ) said, "The Imam is (appointed) to be followed. So do not differ from him, bow when he bows, and say, "Rabbana-lakal hamd" if he says "Sami`a l-lahu liman hamidah"; and if he prostrates, prostrate (after him), and if he prays sitting, pray sitting all together, and straighten the rows for the prayer, as the straightening of the rows is amongst those things which make your prayer a correct and perfect one. (See Hadith No. 657).

Chapter: The straightening of the rows is amongst those obligatory and good things which make your As-Salat (the prayer) a correct and perfect one.

Grade: Sahih