The Messenger of Allah ﷺ said, "Complete the front row first, then the one behind it. Whatever shortage remains, let it be in the last row."
أن رسول الله ﷺ قال: أتموا الصف المقدم، ثم الذي يليه، فما كان من نقص فليكن في الصف المؤخر.
Abu Dawud (671) and Nasai (818), both from the hadith of Saeed, from Qatada, from Anas bin Malik, mentioned the hadith. Saeed here is Ibn Abu Aruba. Ahmad (12352) also narrated it, and Ibn Khuzayma (1546) graded it sahih after narrating it through this route.