The main function of the kidneys is to regulate the amount of water in the body and to remove harmful chemicals known as toxins from your blood. The kidneys secrete these toxins into urine.