The second is that he has committed something forbidden—specifically prohibited in the prayer—and committing what is forbidden in an act of worship specifically entails its invalidity.
However, the majority of scholars hold that his prayer is not invalidated by raising his gaze toward the sky. Yet, according to the stronger view, he is undoubtedly sinful, because a threat is not issued merely for doing something disliked.
Thus, except in the cases mentioned above, the worshipper should look either straight ahead or at the place of his prostration. But which of the two is preferable?
The answer is that he should choose whichever is more conducive to humility and attentiveness of the heart, except in two situations: in a state of fear, and when seated. When seated, he should direct his gaze to the place toward which he points with his finger, as established in the Sunnah from the Prophet, peace and blessings be upon him (1).
It is remarkable that some of those who held that one should look at the Ka'bah justified this by claiming that looking at the Ka'bah is an act of worship. Yet this reasoning requires proof. How do we know that looking at the Ka'bah is an act of worship? For affirming any act of worship that has no basis in the Sacred Law is an innovation.
Issue: Closing the eyes during prayer.
The correct view is that it is disliked, because it resembles the practice of the Magians when they worship fire: they close their eyes. It has also been said that this is a practice of the Jews. Imitating non-Muslims is, at the very least, forbidden, as Shaykh al-Islam, may Allah have mercy on him, said. Thus, closing one’s eyes in prayer is at least disliked—unless there is a reason for it, such as when there is something around him that would distract him if he were to open his eyes. In that case, he may close them in order to avoid this harm.