The Messenger of Allah ﷺ said, "Allah loves sneezing and dislikes yawning. So when one of you sneezes and praises Allah, it is a duty upon every Muslim who hears him to say, 'May Allah have mercy on you.' But when one of you yawns, let him suppress it as much as he can, and let him not say 'Aah, aah,' for when one of you opens his mouth, Satan laughs at him."Hajjaj said in his version, "As for yawning, it is only from Satan."
حدثنا يحيى بن سعيد عن ابن أبي ذئب عن المقبري وحجاج قال أخبرنا ابن أبي ذئب حدثني سعيد بن أبي سعيد عن أبيه
قال رسول الله ﷺ إن الله عز وجل يحب العطاس ويكره التثاؤب فمن عطس فحمد الله فحق على من سمعه أن يقول يرحمك الله وإذا تثاءب أحدكم فليرده ما استطاع ولا يقل آه آه فإن أحدكم إذا فتح فاه فإن الشيطان يضحك منه أو به قال حجاج في حديثه وأما التثاؤب فإنما هو من الشيطان
Its chain of transmission is sahih. Bukhari related it, 8/61, in the book of manners, chapter on what is recommended when sneezing. Abu Dawud related it, 4/306, no. 5028, in the book of manners, chapter on what has been said about yawning. Tirmidhi related it, 5/86, no. 2746, in the book of manners, similar to Bukhari. And Tayalisi related it, 1/361, no. 1862, Minhah, in the book of dress, chapter on what has been said about yawning and sneezing.