Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) said: "How can the one who raises his head before the imam feel safe from his head being turned into the head of a dog? And those people who raise their gazes towards the sky (in prayer) must certainly stop, or else their sight will be snatched away."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9141