The Messenger of Allah ﷺ said, "By Him in whose hand my soul rests, I can see behind me just as I see what is in front of me. So straighten your rows and perform your bowing and prostration well."
وقال رسول الله ﷺ والذي نفسي بيده إني لأنظر إلى ما ورائي كما أنظر إلى ما بين يدي فسووا صفوفكم وأحسنوا ركوعكم وسجودكم
Its isnad is sahih. Other hadiths have also come by the narration of Abu Hurairah, including, "The imam is appointed only to be followed," and it contains an instruction to straighten the rows. Bukhari related it with his chain from Abdullah bin Muhammad, and from Abu Yaman, in the chapter on prayer, and the oath in the hadith is by Allah the Exalted, meaning, "By Allah, in whose power and grasp my soul rests." It also contains the instruction to straighten the rows and to perform ruku and sujud properly.