Gas exchange primarily takes place in the alveoli of the lungs. These are tiny, balloon-shaped structures that provide a large surface area, which is crucial for efficient gas exchange. The alveoli are lined with a thin layer of epithelial cells and surrounded by a dense network of capillaries.