The kidneys among other functions, help to remove nitrogenous wastes from the body, apart from this, they also play an osmoregulatory function, as they help to control the amount of water and hydrogen carbonate ion. In other words, osmoregulation is the process by which living organisms balance the amount of water to mineral salts in their body fluid.
The osmotic concentration of the blood plasma is affected by the amount of sugar, mineral salts, amino acids and other plasma solute it contains when these substances are present in large amounts. The kidney counteracts this increase by extracting some of these substances from the blood, the kidney extracts more water than usual thereby raising the osmotic concentration of the blood plasma to its original value.