“The Messenger of Allah (ﷺ) said: ‘Do not lift your gaze to the heavens lest your sight be snatched away,” meaning during prayer.
Sunan Ibn Majah Book 5, Hadith 241