حَدَّثَنَا أَبُو مُوسَى ، حَدَّثَنَا ابْنُ أَبِي عَدِيٍّ ، عَنْ سَعِيدٍ ، عَنْ قَتَادَةَ ، عَنْ أَنَسٍ ، أَنَّ نَبِيَّ اللهِ - صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ - ، قَالَ : أَتِمُّوا الصَّفَّ الْمُقَدَّمَ ، فَإِنْ كَانَ نُقْصَانٌ فَلْيَكُنْ فِي الْمُؤَخَّرِ .
It is narrated from Sayyiduna Anas (may Allah be pleased with him) that the Prophet of Allah (peace and blessings be upon him) said: "Complete the first row, and then if there is any shortfall (in the number of worshippers), it should be in the very last row."
Related hadith on this topic