The Prophet ﷺ said, "Allah loves sneezing and dislikes yawning. When someone sneezes and praises Allah, every Muslim who hears him is obligated to respond with a blessing. As for yawning, it comes from Satan, so let him suppress it as much as he can. When he says, 'Haa,' Satan laughs at him."
عن النبي ﷺ: إن الله يحب العطاس، ويكره التثاؤب، فإذا عطس فحمد الله، فحق على كل مسلم سمعه أن يشمته، وأما التثاؤب: فإنما هو من الشيطان، فليرده ما استطاع، فإذا قال: ها، ضحك منه الشيطان
Bukhari related it in al-Adab (6223) from Adam bin Abu Iyas, who said, "Ibn Abu Dhib told us, Saeed Maqburi told us, from his father, from Abu Hurairah," and he mentioned it. Muslim also related it in al-Zuhd wa-l-Raqaiq (2994) through another route from Abu Hurairah, restricting it to the matter of yawning.