Sunan Abi Dawud, Book 41, Hadith 5007 (USC-MSA)

Abu Hurairah reported the Messenger of Allah (May peace be upon him) as saying: Allah likes sneezing but dislikes yawning. So when one of you yawns, he should restrain it as much as possible, and should not say Ha, Ha, for that is from the devil who laughs at him.

حَدَّثَنَا الْحَسَنُ بْنُ عَلِيٍّ، حَدَّثَنَا يَزِيدُ بْنُ هَارُونَ، أَخْبَرَنَا ابْنُ أَبِي ذِئْبٍ، عَنْ سَعِيدٍ الْمَقْبُرِيِّ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ إِنَّ اللَّهَ يُحِبُّ الْعُطَاسَ وَيَكْرَهُ التَّثَاؤُبَ فَإِذَا تَثَاءَبَ أَحَدُكُمْ فَلْيَرُدَّهُ مَا اسْتَطَاعَ وَلاَ يَقُلْ هَاهْ هَاهْ فَإِنَّمَا ذَلِكُمْ مِنَ الشَّيْطَانِ يَضْحَكُ مِنْهُ ‏" ‏ ‏.‏

sunnah.com