The Prophet ﷺ said, "Straighten the rows in prayer, for straightening the rows is part of the excellence of prayer."
عن النبي ﷺ قال: أقيموا الصف في الصلاة، فإن إقامة الصف من حسن الصلاة.
Muslim narrated it in the Book of Prayer (435), from Muhammad bin Rafi, from Abdul-Razzaq, who said, Mamar narrated to us, from Hammam bin Munabbih, who said, This is what Abu Hurairah narrated to us from the Messenger of Allah ﷺ, and he then mentioned several hadiths, including this one.Bukhari narrated it in the Book of Adhan (722), from Abdullah bin Muhammad, who said, Abdul-Razzaq narrated it to us in the same manner. He began the hadith with the statement, "The imam is appointed only so that he may be followed," and this hadith will come in its place. He then mentioned the hadith about establishing the prayer.As for Muslim and others, they treated it as two separate hadiths.