Yawning, then, would be an involuntary reflex to help us control our oxygen and carbon dioxide levels. Sounds good, but other studies have shown that breathing more oxygen does not decrease yawning. Likewise, breathing more carbon dioxide does not increase yawning.
Another theory is that yawning stretches the lungs and lung tissue. Stretching and yawning may be a way to flex muscles and joints, increase heart rate, and feel more awake.