Until recently, the most possible explanation was that yawning increased the supply of oxygen to the brain. However, there is mounting scientific evidence to suggest that yawning has more to do with temperature than oxygen. As brain temperature rises, concentration and memory suffer, and a number of tests in humans and animals have shown that yawning is linked to heat, and increases when our brains are getting too warm. By taking a deep breath of cool air, brain temperature drops back down, increasing alertness.
Contagious yawning is triggered involuntarily when we observe another person yawn and a propensity for contagious yawning is found in chimpanzees, cats, and dogs too. Experts have published research that suggests the human propensity for contagious yawning is triggered automatically by primitive reflexes in the primary motor cortex (an area of the brain responsible for motor function)