Praise be to Allah.
The scholars are agreed that it is makrooh to close the eyes for no reason when praying. The author of al-Rawd stated that it is makrooh because this is what the Jews do. (al-Rawd al-Murabba’, 1/95). The authors of Manaar al-Sabeel and al-Kaafi stated likewise, and added that it looks as if the person is asleep. (Manaar al-Sabeel, 1/66; al-Kaafi, 1/285). The author of al-Iqnaa’ stated that it is makrooh 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-Iqnaa’, 1/127; al-Mughni, 2/30). The author of al-Mughni said likewise.
The author of Tuhfat al-Mulook said that it is makrooh without discussing the ruling when there is a need to do it. (Tuhfat al-Mulook, 1/84). Al-Kaasaani said: it is makrooh 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. (Badaa’i’ al-Sanaa’i’, 1/503). The author of Maraaqi al-Falaah stated that it is makrooh unless done for a purpose. He said, closing the eyes may be preferable to looking in some cases (Maraaqi al-Falaah, 1/343).
Imaam al-‘Izz ibn ‘Abd al-Salaam said in his fatwas that it is permissible when necessary, if that helps the worshipper to focus more fully on his prayer. Ibn al-Qayyim said in Zaad al-Ma’aad 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 makrooh at all and the view that in this case it is mustahabb for him to close his eyes is closer to the aims and principles of sharee’ah than saying that it is makrooh. (Zaad al-Ma’aad, 1/283).