Yawning is a mostly involuntary process of opening the mouth and breathing in deeply, filling the lungs with air. It's a very natural response to being tired. In fact, yawning is usually triggered by sleepiness or fatigue. Some yawns are short, and some last for several seconds before an open-mouthed exhale.
Is yawning due to a lack of oxygen?
This seems logical since yawning does bring in more oxygen with a deep breath and the expiration removes more carbon dioxide than the usual breath, but research by putting people in low-oxygen or high- carbon-dioxide environments does not cause yawning.
What causes yawning and why do we do it?
Here's the basic idea: When you start to yawn, powerful stretching of the jaw increases blood flow in the neck, face, and head. The deep intake of breath during a yawn forces downward flow of spinal fluid and blood from the brain. Cool air breathed into the mouth cools these fluids.