Narrated Abu Hurairah: The Prophet ﷺ said: Have the imam in the centre and close up the gaps.
Related hadith on this topic
Explanation & Benefits
Shaykh Umar Farooq Saeedi
681. Commentary:
That is, the imam should stand ahead of the rows in such a way that he is in the middle of the congregation (muqtadis), and it should not be that the muqtadis are greater in number on either the right or left side, for in such a case the imam would not remain in the center. The same should be the case for the last row, in which there are only a few individuals; that is, they should not stand at one end of the row, but rather in the middle (with the imam to their right and left), so that the imam remains in the center. However, the first part of this narration is weak, so it can be considered recommended (mustahabb), but not obligatory. As for the second part of the hadith, “Fill the gaps in the rows,” it is authentic, because this command is also established from other ahadith.
Source: Sunan Abu Dawood – Commentary by Shaykh Umar Farooq Saeedi, Page: 681