The exchange of oxygen and carbon dioxide between alveolar air and pulmonary capillary blood that occurs across the blood-air barrier.