Sahih Muslim 7492
The Book of Zuhd and Softening of Hearts
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا عَبْدُ الْعَزِيزِ، عَنْ سُهَيْلٍ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ أَبِي، سَعِيدٍ عَنْ أَبِيهِ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ " إِذَا تَثَاوَبَ أَحَدُكُمْ فَلْيُمْسِكْ بِيَدِهِ فَإِنَّ الشَّيْطَانَ يَدْخُلُ " .
The son of Abu Said al-Khudri reported on the authority of his father that Allah's Messenger (ﷺ) said:When one of you yawns, he should try to restrain it with cue help of his hand since it is the Satan that enters therein
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.