When we inhale, the membranes of alveoli inside the lungs get blown up like balloons so that the surface area increases. Increase in surface area enhances better gas exchange.
The walls of alveoli are covered by extensive network of blood vessels or capillaries in which oxygen from alveoli dissolves and are carried by the blood to the heart for pumping. In the same way carbon dioxide from the body cells are carried by the blood capillaries to the alveoli from where it goes out of the body.