Riyad as-Salihin, Book 9, Hadith 1086 (In-Book)

Abu Mas'ud (May Allah be pleased with him) reported: The Messenger of Allah used to gently pat our shoulders when we were standing in rows at the time of Salat and say, "Keep (the rows) straight; do not differ from each other lest your hearts should suffer from discord. Let those of you who are mature and prudent be nearer to me, and then those who are next to them."[Muslim].

وعن أبي مسعود رضي الله عنه قال‏:‏ كان رسول الله صلى الله عليه وسلم يمسح مناكبنا في الصلاة، ويقول‏:‏ ‏ "‏استووا ولا تختلفوا فتختلف قلوبكم، ليلني منكم أولو الأحلام والنهى، ثم الذين يلونهم ثم الذين يلونهم‏" ‏‏.‏ ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏

sunnah.com