The respiratory system helps regulate acid-base balance by controlling the levels of CO2 in the blood. CO2 is a byproduct of cellular metabolism and can combine with water to form carbonic acid, which dissociates into hydrogen ions and bicarbonate. By adjusting the rate and depth of breathing, the lungs can excrete more CO2 or retain it, thereby influencing blood pH.