Praise be to Allah.
It is narrated that there is a particular virtue in competing to pray in the first row and the next row, and so on, behind the imam.
Al-Bukhari (615) and Muslim (437) narrated from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “If the people knew what there is (of reward) in the call and the first row, and they could find no other way than drawing lots, then they would draw lots. If they know what there is (of reward) in coming early to prayer, they would compete for it. If they knew what there is (of reward) in ‘Isha’ and Fajr prayer, they would come to them even if they had to crawl.”
Muslim (438) narrated from Abu Sa‘id al-Khudri (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) saw some of his companions going towards the back (of the mosque). He said to them: “Come forward and follow me (in the prayer), and let those who are behind you follow you, for people will keep moving to the back until Allah puts them back (from great reward or high status).”
Regarding the virtue of being close to the imam on Friday in particular, there is a report narrated by Samurah ibn Jundub, according to which the Prophet of Allah (blessings and peace of Allah be upon him) said: “Attend the reminder (the khutbah) and come close to the imam, for if a man continues to distance himself, his admittance to Paradise will be delayed, even if he enters it.” Narrated by Abu Dawud (1108). Shaykh al-Albani (may Allah have mercy on him) said: Its isnad is sahih. Al-Hakim said: It is sahih according to the conditions of Muslim, and al-Dhahabi agreed with him. End quote from Sahih Sunan Abi Dawud (Gharras edn., 4/271).
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
With regard to Jumu‘ah prayer and other prayers, the people should fill the gaps in the first row, then the next row, and so on, as it was narrated in al-Sahihayn that the Prophet (blessings and peace of Allah be upon him) said: “Why do you not stand in rows as the angels stand in rows before their Lord?” They said: How do the angels stand in rows before their Lord? He said: “They complete the first rows and leave no gaps in the rows.” So no one should fill gaps in the back rows when there are still gaps in the front rows, and no rows should be formed in the streets and stores when there is still space inside the mosque… Rather if the rows in the mosque have been filled and there is no more space, then they may form rows outside the mosque, and if there are no large gaps between the rows and they form rows in the streets and marketplaces, then their prayer is valid…"(Majmu‘ al-Fatawa 23/209-210).
The scholars regarded it as recommended (mustahabb) to stand on the right-hand side of the row. Among the evidence they quoted for that is the report narrated by Imam Muslim (709) from al-Bara’, who said: When we prayed behind the Messenger of Allah (blessings and peace of Allah be upon him), we liked to be on his right so that his face would turn towards us. And I heard him say: “O Lord, save me from Your punishment on the Day when You resurrect or gather Your slaves.”
They also regarded it is recommended to be close to the imam, as is mentioned in the hadith of Abu Mas‘ud, who said: The Messenger of Allah (blessings and peace of Allah be upon him) used to touch our shoulders when we were praying and he would say: “Make the rows straight and do not differ, lest your hearts differ. Let those who are adults and mature in thinking be closest to me, then those who come after them, then those who come after them.” Narrated by Muslim (432).
Ibn al-Jawzi (may Allah have mercy on him) said: He only enjoined that for three reasons, the first of which is preferring them to be in the first row. Secondly, it was so that they might understand what movement he was doing; and thirdly, because he might need them to remind him if he made an error, or he might need them to take over and lead the prayer if something happened to him. By giving preference to them, this teaches those who have less knowledge to show good manners and keep away from that place. And his words “then those who come after them” refer to those who are lower in status."(Kashf al-Mushkil 1/327).
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said:
Is the right-hand side best in all cases, meaning the right-hand side of any row, or if the space on the right is far away from the imam, is the left-hand side better if the space is closer to the imam?
The answer is: the right-hand side is better if the space is closer to the imam, and the evidence for that is the fact that the Prophet (blessings and peace of Allah be upon him) did not say: Complete the right, then the next right, and so on. Rather he said: “Complete the first row, then the next, and so on.” Hence we say regarding the first and second rows that the first row is better than the second, even if one can stand in line with the imam in the second row, and the space in the first row is at the very end of the row, because the Prophet (blessings and peace of Allah be upon him) enjoined us to complete the first row, then the next, and so on. As for the right-hand side, he did not say: Complete the right then the next right, and so on. If the right-hand side was better in all cases, he would have said: Complete the right then the next right, and so on. Based on that, we say: If spaces on the right and left are of a similar distance from the imam, then the space on the right-hand side is better. If spaces on the right and the left are equally distant from the imam, then the space on right-hand side is better. But if the space on the right is further away from the imam, then the space on the left-hand side is better, because it is closer to the imam, and being close to the imam is something desirable according to Islamic teachings."(Liqa’ al-Bab al-Maftuh 215/10).
Competing to be in the first rows and to be close to the imam is something recommended (mustahabb), and the virtue of the first row is greater than that of the second, and the second is better than the third, and so on.
Being on the right-hand side of the first row is better than being on the left-hand side of it, but being on the left-hand side of the front row is better than being on the right-hand side of the row behind it. Standing in the back rows when one is able to move forward is blameworthy.
And Allah knows best.