I agree with Barb.
Eating moderately and healthily keeps your metabolism running which enables you to burn calories an lose weight. If you sleep a lot and aren't eating correctly your body with store your calories and/or convert them to fat stores which is the opposit of what you want.
Eating and sleep are both necessary to be healthy. Either one can help you lose weight, or make you gain weight, depending on how much you do.