Dr. Provine suggests that perhaps yawning is like stretching. Yawning and stretching increase blood pressure and heart rate and also flex muscles and joints. Evidence that yawning and stretching may be related comes from the observation that if you try to stifle or prevent a yawn by clenching your jaws shut, the yawn is somewhat "unsatisfying." For some reason, the stretching of jaw and face muscles is necessary for a good yawn.
In 2007, researchers proposed that yawning is used to cool the brain. They found that people yawned more often they pressed a warm or room temperature towel against their heads than when they pressed a cold towel against their heads. People who breathed through their noses (thought to reduce brain temperature) did not yawn at all.
It is possible that yawns are contagious because at one time in evolutionary history, the yawn served to coordinate the social behavior of a group of animals. When one member of the group yawned to signal an event, all the other members of the group also yawned. Yawns may still be contagious these days because of a leftover response (a "vestigial" response) that is not used anymore. None of this has been proven true and yawns are still one of the mysteries of the mind.