Sayyiduna Anas (may Allah be pleased with him) narrated that the Noble Prophet (peace and blessings be upon him) said: "What is the matter with people who raise their eyes towards the sky during prayer?" He (peace be upon him) forbade them very sternly until he (peace be upon him) said: "You must stop this action, or else Allah, the Exalted, will take away your sight."
Hadith Referenceسنن دارمي / من كتاب الصللاة / 1338
Hadith Gradingتحقیق (حسین سلیم أسد الدارانی):إسناده صحيح محمد بن بشر سمع من سعيد قبل اختلاطه، [مكتبه الشامله نمبر: 1340]
In this hadith, there is the severest warning regarding raising one's gaze towards the sky during prayer, and that is: it is possible that Allah Ta'ala may take away their eyesight. Therefore, one must avoid this during prayer.