The Messenger of Allah ﷺ used to walk through the rows from one side to the other, straightening our chests and shoulders, saying, "Do not stand unevenly, or your hearts will differ."He would also say, "Indeed, Allah and His angels send blessings upon the front rows."
حدثنا هناد بن السري وأبو عاصم بن جواس الحنفي عن أبي الأحوص عن منصور عن طلحة اليامي عن عبد الرحمن بن عوسجة
كان رسول الله ﷺ يتخلل الصف من ناحية إلى ناحية يمسح صدورنا ومناكبنا ويقول لا تختلفوا فتختلف قلوبكم وكان يقول إن الله وملائكته يصلون على الصفوف الأول
[Its isnad is sahih]Nasai narrated it in the Book of Leadership in Prayer, chapter on how the imam should arrange the rows, no. 812, from the hadith of Abu Ahwas, with this wording. Ibn Khuzayma graded it sahih, no. 1551, 1556, as did Ibn Hibban, no. 386. Ibn Majah also narrated it, no. 997, through another route from Talha bin Musarrif Yaami, with this wording.