Can You Close Your Eyes in Prayer?
Question

What is the ruling on closing the eyes when praying?
Praise be to Allah.The scholars agreed that it is disliked to close the eyes in prayer for no reason when praying. The author of Ar-Rawd stated that it is disliked because this is what the Jews do. (Ar-Rawd Al-Murabbi`, 1/95)
The authors of Manar As-Sabil and Al-Kafi stated likewise, and added that it looks as if the person is asleep. (Manar As-Sabil, 1/66; Al-Kafi, 1/285) 
The author of Al-Iqna` stated that it is disliked unless there is a reason for doing so, such as fear of seeing something one should not be looking at whilst praying, such as seeing one’s concubine or wife, or a non-mahram woman, naked. (Al-Iqna`, 1/127; Al-Mughni, 2/30). The author of Al-Mughni said likewise. 
The author of Tuhfat Al-Muluk said that it is disliked without discussing the ruling when there is a need to do it. (Tuhfat Al-Muluk, 1/84). 
Al-Kasani (may Allah have mercy on him) said: “It is disliked because it goes against the Sunnah, which is to focus the gaze on the place of prostration, and because all of a person’s faculties have a role to play in worship, including the eyes. (Bada’i` As-Sana’i`, 1/503) 
The author of Maraqi Al-Falah stated that it is disliked unless done for a purpose. He said, closing the eyes may be preferable to looking in some cases. (Maraqi Al-Falah, 1/343) 
Imam Al-`Izz ibn `Abd As-Salam (may Allah have mercy on him) said in his Fatwas that closing the eyes when praying is permissible when necessary, if that helps the worshipper to focus more fully on his prayer. 
Ibn Al-Qayyim (may Allah have mercy on him) said in Zad Al-Ma`ad that if a man can focus more fully on his prayer by opening his eyes, then it is better to do so. If he can focus more fully by closing his eyes because there are things that may distract him from his prayer, such as adornments and decorations, then it is not disliked at all and the view that in this case it is recommended for him to close his eyes is closer to the aims and principles of Shari`ah than saying that it is disliked. (Zad Al-Ma’ad, 1/283)
For more details, please refer to the following answers: 119576 , 160647 , 10667 , and 69819 .
And Allah knows best.