Abu Hurairah (May Allah be pleased with him) reported: The Prophet (PBUH) said, "Allah likes sneezing and dislikes yawning. When any one of you sneezes and says `Al-hamdu lillah (praise be to Allah), it becomes obligatory upon every Muslim who hears him to respond with `Yarhamuk-Allah (may Allah have mercy on you). Yawning is from the devil. When one of you feels like yawning, he should restrain it as much as possible, for the devil laughs when one of you yawns."[Al-Bukhari].
Sneezing lightens the mind of man, and bodily he feels comfort. It is, therefore, something good and one should glorify Allah for it. Whereas, yawning is indicative of gluttony, sloth and heaviness and is considered disagreeable. The Prophet (PBUH) commanded us to stop it either by closing our mouth or by putting our hand across it in order to avoid an act which pleases Satan.