The liver aids in digestion and regulates blood sugar by storing excess sugar and releasing it when it is needed. Blood from the intestine (through the hepatic portal vein) may carry a lot of sugar if the organism has just eaten. That excess sugar is stored as glycogen. If an organism requires more sugar, perhaps because it is under stress (activity), then glycogen is broken back down and the simple sugars are released into the blood stream.
In addition, the liver helps in the breakdown of proteins. Proteins are long strings of amino acids, which are broken down to ammonia - very toxic! The liver converts the ammonia to urea, a relatively benign nitrogenous waste which is filtered out of the blood at the kidneys (more about that below).
Factoid: urea was the compound that disproved the idea of vitalism.
"Urea was first discovered in human urine by H.M. Rouelle in 1773. It was synthesized in 1828 by Friedrich Wohler and was the first organic compound to be synthesized from inorganic starting materials. It was found when Wohler attempted to synthesis ammonium cyanate, to continue a study of cyanates which he had been carrying out for several years. On treating silver cyanate with ammonium chloride solution he obtained a white crystalline material which proved identical to urea obtained from urine.
This discovery prompted Wohler to write triumphantly to Berzelius, "I must tell you that I can make urea without the use of kidneys, either man or dog. Ammonium cyanate is urea."
This organic synthesis dealt a severe blow to a widespread belief called "vitalism" which maintained that organic chemicals could be modified by chemistry but could only be produced through the agency of a vital force present in living plants and animals." - quoted from another webpage.
The liver has two homeostatic functions: blood sugar regulation nitrogenous waste conversion