The primary function of the respiratory system is to exchange oxygen and carbon dioxide. Inhaled oxygen enters the lungs and reaches the alveoli. The layers of cells lining th…e alveoli and the surrounding capillaries are each only one cell thick and are in very close contact with each other.