To say the word yawn applies to any time someone gapes or keeps their mouth open is to use it in very loose context and, although this usage is strictly correct, is not the intended meaning of the word in the context of this thread. There is a specific thing that happens to us when we yawn, which is a lot more than simply keeping our mouths open. In fact sometimes opening your mouth wide for a short time can actually induce yawning. We also observe yawning in other animals; mammals definitely but I'm not sure about amphibians and reptiles. Humans have always associated it with fatigue, but I wonder what the actual biological purpose (if any) actually is.

A long-standing hypothesis is that yawning is caused by an excess of carbon dioxide and lack of oxygen in the blood. The brain stem detects this and triggers the yawn reflex. The mouth stretches wide and the lungs inhale deeply, bringing oxygen into the lungs and hence to the bloodstream. It is almost certain however, that this hypothesis is not correct. A more recent hypothesis is that yawning is used for regulation of body temperature. Another hypothesis is that yawns are caused by the same chemicals (neurotransmitters) in the brain that affect emotions, mood, appetite and other phenomena. These chemicals include serotonin, dopamine, glutamic acid and nitric oxide. As more of these compounds are activated in the brain, the frequency of yawning increases. Conversely, a greater presence in the brain of opiate neurotransmitters such as endorphins, reduces the frequency of yawning. Patients taking the serotonin reuptake inhibitor Paxil (Paroxetine HCl) have been observed yawning abnormally often.

Another theory is that yawning is similar to stretching. Yawning, like stretching, increases blood pressure and heart rate while also flexing many muscles and joints. Some have observed that if you try to stifle or prevent a yawn by clenching your jaws shut, the yawn is unsatisfying. As such, the stretching of jaw and face muscles seems to be necessary for a good yawn.

The yawn reflex is often described as contagious: if one person yawns, this will cause another person to "sympathetically" yawn. The reasons for this are unclear; however, recent research suggests that yawning might be a herd instinct. Other theories suggest that the yawn serves to synchronize mood behavior among gregarious animals, similar to the howling of the wolf pack during a full moon. It signals tiredness to other members of the group in order to synchronize sleeping patterns and periods of activity. It can serve as a warning in displaying large, canine teeth, thus proclaiming, "don't attack while I am sleeping..." The contagion of yawning is interspecific (i.e., try yawning in front of your dog). Ironically, yawning in public is generally regarded as impolite in the West, but came into fashion in polite French society for a brief period in the late 18th century. Oddly, sometimes sympathetic yawning may be caused by simply looking at a picture of a person or animal yawning, or even seeing the word "yawn".

Adelie Penguins employ yawning as part of their courtship ritual. Penguin couples face off and the males engage in what is described as an "ecstatic display," their beaks open wide and their faces pointed skyward.

Children under 5 years do not appear to find yawning contagious just like in chimps. Some studies suggest contagious yawning to be a result of empathy and self-awareness, both of which require a sophisticated intellect.

The most plausible explanation, and the one that is taught in medical school, is that we yawn because oxygen levels in our lungs are low. Studies have shown that during normal, at-rest breathing, we don’t use anywhere near our lung capacity; for the most part, we just use the air sacs at the bottom of the lungs. If the air sacs, called alveoli, don’t get fresh air, they partially collapse and the lungs stiffen a bit. As a result, it’s believed, our brain prompts the body to either sigh or take a yawn to get more air into the lungs.

But certain aspects of yawning remain even more mysterious. Fetuses, for instances, have been observed yawning in the womb, yet it’s known that they don’t take oxygen in through their lungs. And yawning seems to be a symptom of multiple sclerosis and other medical conditions, for reasons unclear.

Another puzzling phenomenon is that some male animals, men included, yawn in association with penile erection (although it’s presumptuous to assume they’re bored with their sex lives).