The Messenger of Allah ﷺ said, "Part of performing the prayer well is straightening the rows."
حدثنا يزيد حدثنا همام عن قتادة
عن رسول الله ﷺ قال إن من حسن الصلاة إقامة الصف
Its isnad is sahih. Ibn Abu Shayba narrated the hadith in the chapter on Prayer, 1/351, in the section on straightening the rows.