it should be known that straightening rows and filling in the gabs in jama`ah prayer is of great virtue and entails many benefits. The late Sheikh Sayyed Sabiq states: “It is preferable for the Imam, before he starts the prayer, to order people praying behind him to straighten the rows and fill in any gaps. Anas (may Allah be pleased with him) related: “Before starting salah (prayer), the Prophet would turn his face to us and say: ‘Be close together and straighten your rows.'” (Reported by Al-Bukhari and Muslim)
He (Anas) also quoted the Prophet (peace and blessings be upon him) as saying: “Make your rows straight for straightening the rows is part of the perfection of salah.”
Moreover, An-Nu`man ibn Bashir (may Allah be pleased with him) reported: “The Prophet (peace and blessings be upon him) would straighten us in our rows as one straightens an arrow, until he saw that we had heeded the order. One day, he saw a person with his chest sticking out and he said: ‘You had better straighten your rows or Allah will cause differences among you.”‘ (Reported by Al-Bukhari and Muslim)
Also on this issue, Abu Umamah (may Allah be pleased with him) quoted the Prophet (peace and blessings be upon him) as saying: “Straighten your rows and put your shoulders close to each other and be gentle with each other and fill in the gaps for the Satan passes through any gap between you just as lamp [penetrate gaps].” (Reported by Ahmad and At-Tabarani)
Ibn `Umar (may Allah be pleased with them both) said: “There is no step that carries a greater reward than the step a man takes to straighten a row in prayer.” (Reported by Al-Bazar)
Jabir Ibn Samrah (may Allah be pleased with him) reported: “The Prophet (peace and blessings be upon him) came to us and said: ‘Why don’t you make the rows like the angels make their rows in the presence of their Lord?’ We asked: ‘O Messenger of Allah, how do the angels make their rows in the presence of their Lord?’ He replied: ‘They complete the first row and stand closely together, side by side, in the row.'” (Reported by the Group, save Al-Bukhari and At-Tirmizi)”