Ibn Umar رضیﷲ عنه reported that Prophet Mohammad صلی اللہ علیہ وسلم said:
إِذَانَعَسَ أَحَدُكُمْ يَوْمَ الْجُمُعَةِ فَلْيَتَحَوَّلْ مِنْ مَجْلِسِهِ ذَلِكَ
When one of you becomes sleepy during the Friday prayer, then let him move from where he is sitting
[Jami at Tirmidhi #526, Mishkaat al Masabih #1394 sanad Hasan By Imam Zubair Ali Zai]
Imam As Shawkani رحمہ اللہ said: the wisdom behind it that it will wipe out his sleepiness.
[Nayl al Awtar 2/537]