There are many theories about why a yawn occurs. Although researchers and medical experts may have some good ideas about some of the causes for a yawn, a considerable portion of the reason why people yawn remains a mystery.

There are a number of theories designed to explain why do we yawn. The most common theory is that yawning is a result of boredom or tiredness; however, some think that the yawn is caused because the brain is too warm.
Scientists suggest that when you’re sleepy, tired, or bored, your breathing slows down and as a result, the required amount of oxygen is not produced in the body that is necessary for its functioning. In addition, slow breathing increases the levels of carbon dioxide gas in the body. As a means of coping, the brain triggers the yawning action.
A yawn is characterized by a wide opening of the mouth and the dropping of one’s jaw. This allows the maximum amount of air to be taken in by the lungs. This is followed by the slow exhalation of air alongside the flexing of abdominal muscles, the expanding of eardrums, and the pushing down of the diaphragm.
When the brain needs a pick-me-upper, it will induce actions that trigger the long inhalation, filling the lungs with their full air capacity, dispelling the lungs of stale air, increasing your heart rate, and reviving of your senses.
Another theory is that you yawn when your brain temperature rises. Your brain resembles a computer, which functions best in cooler environments. So when the brain temperature rises, you tend to yawn and the inhalation of cool air promotes the lowering of the brain temperature, resulting in your brain working more efficiently.
There are studies that support this theory. One study, conducted in New York, showed a video where people were yawning. The participants placed hot packs on their foreheads which resulted in the increase in brain temperature. In effect, the participants yawned more. The same participants placed cool packs on their foreheads to lower their brain temperature. As a result, their levels of yawning were reduced.
They also discovered that breathing through your nose instead of your mouth would reduce yawning levels. This is due to the fact that the nasal cavity vessels function to send the brain cool blood.
Most scientists believe that yawning is contagious because it is an inherent means of communicating with others.
In ancient times when language was still in its infancy, your ancestors would use signals to communicate with one another. They would stay in large groups wherein their safety and survival depended on their capacity to communicate with each other. For instance, if danger was coming, they would bare their teeth. This meant aggression and that they were ready to put up a fight.
Yawning could have been a signal of tiredness, which would lead to a group yawn. Such an awareness of this tiredness would encourage each member to stay awake and remain vigilant in order to survive. Or, it may have simply been a sign that it was time for them all to sleep.
Another reason why yawning appears to be contagious is based on the principle of the “mirroring effect.” When you see others yawning, the mirror neurons in the brain can cause the mirroring effect and as such neurons fire up, this will lead to the yawning reaction.
Another possibility involves the concept of “empathy hormones.” Empathy is defined as putting yourself in someone else’s shoes, understanding what they’re experiencing, and identifying their points of view.
This theory suggests that when you see someone else yawning, your empathy hormones become activated. This leads you to feel what they are feeling, and to yawn yourself. This is the reason why you tend to yawn more easily when the person who is yawning is close to you as opposed to a stranger.