كتاب الصلاة
4  
The Book of Prayers
(26)
Chapter: The Prohibition On Lifting Ones Gaze To The Heavens When in Salat
(26)
باب النَّهْىِ عَنْ رَفْعِ الْبَصَرِ، إِلَى السَّمَاءِ فِي الصَّلاَةِ ‏
Sahih Muslim 428

Jabir b. Samura reported:

The Messenger of Allah (ﷺ) said: The people who lift their eyes towards the sky in Prayer should avoid it or they would lose their eyesight.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَأَبُو كُرَيْبٍ قَالاَ حَدَّثَنَا أَبُو مُعَاوِيَةَ، عَنِ الأَعْمَشِ، عَنِ الْمُسَيَّبِ، عَنْ تَمِيمِ بْنِ طَرَفَةَ، عَنْ جَابِرِ بْنِ سَمُرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ لَيَنْتَهِيَنَّ أَقْوَامٌ يَرْفَعُونَ أَبْصَارَهُمْ إِلَى السَّمَاءِ فِي الصَّلاَةِ أَوْ لاَ تَرْجِعُ إِلَيْهِمْ ‏"‏ ‏.‏
Reference : Sahih Muslim 428
In-book reference : Book 4, Hadith 128
USC-MSA web (English) reference : Book 4, Hadith 862
  (deprecated numbering scheme)