When you sleep, your body gets rid of toxins, etc., it does not need, plus it's easier for the body to fight an infection or something along those lines when you sleep, that's why you hear the line: "Get plenty of rest!"
As for how long to sleep, it's up to you. Some people are night owls...