The alveolar oxygen pressure is lower than the atmospheric O2 partial pressure for two reasons.
Firstly, as the air enters the lungs, it is humidified by the upper airway and thus the partial pressure of water vapour (47 mmHg) reduces the oxygen partial pressure to about 150 mmHg.
The rest of the difference is due to the continual uptake of oxygen by the pulmonarycapillaries, and the continual diffusion of CO2 out of the capillaries into the alveoli.
The factors that determine the values for alveolar PO2 and PCO2 are:
The pressure of outside air
The partial pressures of inspired oxygen and carbon dioxide
The rates of total body oxygen consumption and carbon dioxide production
The rates of alveolar ventilation and perfusion
The alveolar pO2 is not routinely measured but is calculated from blood gas measurements by the Alveolar gas equation.
Pathology
Hypoventilation exists when the ratio of carbon dioxide production to alveolar ventilation increases above normal values.