The Messenger of Allah ﷺ said, "Complete the first row, then the one that follows it, and if there is to be any shortage, let it be in the last row."
أخبرنا إسمعيل بن مسعود عن خالد قال حدثنا سعيد عن قتادة
أن رسول الله ﷺ قال أتموا الصف الأول ثم الذي يليه وإن كان نقص فليكن في الصف المؤخر
[Sahih] Reported by Abu Dawud, Prayer, chapter on straightening the rows, hadith no. 671, from the hadith of Saeed bin Abu Aruba, and Shuba followed him in the narration found in Ibn Khuzayma, hadith no. 1547, as did Abu Aban bin Yazid in the narration found in Ibn Hibban, hadith no. 391, and it is also found in Kubra, hadith no. 892.