The kidneys regulate the pH of the blood by regulating the reabsorption and secretion of protons and bicarbonate ions.