I prayed beside Anas bin Malik one Friday, and we were pushed up against the pillars, so some of us moved forward and others moved back.Anas said, "We used to avoid this during the time of the Messenger of Allah ﷺ."
حدثنا محمد بن بشار حدثنا عبد الرحمن حدثنا سفيان عن يحيى بن هانئ
صليت مع أنس بن مالك يوم الجمعة فدفعنا إلى السواري فتقدمنا وتأخرنا فقال أنس كنا نتقي هذا على عهد رسول الله ﷺ
[Its chain is sahih] Reported by Tirmidhi, Prayer, chapter on what has been mentioned regarding the dislike of standing in rows between pillars, hadith: 229, from the hadith of Sufyan Thawri through this chain, and he said, "Hasan." Ibn Khuzayma graded it sahih, hadith: 1568, as did Ibn Hibban (al-Ihsan): 2215, and Hakim: 1/210, 218, and Dhahabi agreed with him. Thawri stated clearly that he heard it directly, as recorded by Bayhaqi: 3/104 and Hakim.