Anas ibn Mālik (may Allah be pleased with him) reported that the Messenger of Allah (ﷺ) said: "Complete the front row first, then the one following it. If there is any deficiency (in the rows), let it be in the last row."
Authentic - Narrated by Abu Dāwūd and Al-Nasā’i
The Prophet (ﷺ) commanded the men praying in congregation to complete the first row, then to complete the row behind it, and so on. If there is any deficiency in a row, let that deficiency be in the last row.
لە سوودەکانی فەرموودەکە
Clarification of the Sunnah regarding straightening the rows (in prayer).
Worshippers should not leave gaps in the front rows; rather, any deficiency should be in the last row.