The Prophet ﷺ said, "Yawning is from Satan, so when one of you yawns, let him suppress it as much as he can, for when one of you says 'Haa,' Satan laughs."In another narration, "Allah loves sneezing and dislikes yawning. So when someone sneezes and praises Allah, it is the duty of every Muslim who hears him to respond with a blessing." Then he mentioned it.
عن النبي ﷺ قال: التثاؤب من الشيطان، فإذا تثاءب أحدكم فليرده ما استطاع فإن أحدكم إذا قال: ها، ضحك الشيطان. وفي رواية: إن الله يحب العطاس، ويكره التثاؤب. فإذا عطس فحمد الله فحق على كل مسلم سمعه أن يشمته، ثم ذكره.
Bukhari related it in the Book of the Beginning of Creation (3289), from Asim bin Ali, who said, Ibn Abu Dhib narrated to us, from Saeed Maqburi, from his father, from Abu Hurairah, who mentioned the same. The second narration was also related by Bukhari in the Book of Manners (6223), from Adam bin Abu Iyas, and he also related it (6226) from Asim bin Ali, both of them from Ibn Abu Dhib, with the same wording.Muslim related it in the Book of Asceticism and Softening of the Hearts (2994), from Ali bin Hajar, who said, Ismail bin Jafar narrated to us, from Ala bin Abdul-Rahman, from his father, from Abu Hurairah, with this wording, "Yawning is from Satan. So when one of you yawns, let him suppress it as much as he can."Tirmidhi related it (370) from Ali bin Hajar with the same chain, except that he added the word "prayer," saying, "Yawning during prayer is from Satan..." He said, hasan sahih. However, Shaykh Ahmad Shakir denied that the addition of "prayer" appeared in the rest of the sources.I say, this addition has indeed been established in the narration of Abu Abbas Mahbubi, the transmitter of the Sunan, and Baghawi extracted it through his route in Sharh al-Sunnah (3/243), adding the word "prayer."Tirmidhi said, some people of knowledge disliked yawning during prayer. Ibrahim said, "I ward off yawning by clearing my throat."Then Tirmidhi related it (2746) through another route, from the hadith of Muhammad bin Ajlan, from Maqburi, from Abu Hurairah, that the Messenger of Allah ﷺ said, "Sneezing is from Allah, and yawning is from Satan. So when one of you yawns, let him place his hand over his mouth. And if he says, 'Aah, aah,' then Satan is laughing from inside him. Indeed, Allah loves sneezing and dislikes yawning." He said, hasan sahih.See the rest of the hadiths in the Book of Manners.