The Prophet (ﷺ) said: Have the imam in the centre and close up the gaps.
Sunan Abi Dawud Book 2, Hadith 291