Ibn 'Umar (May Allah be pleased with them) reported:
The Messenger of Allah (ﷺ) said, "Arrange the rows in order, stand shoulder to shoulder, close the gaps, be accommodating to your brothers, and do not leave gaps for Satan. Whoever joins up a row, he will be joined to Allah (i.e., to the Mercy of Allah); and whoever cuts off a row, he will be cut off from Allah (i.e., from His Mercy)."[Abu Dawud].
App reference: Book 9, Hadith 101
Arabic/English book reference: Book 9, Hadith 1091