Eating a small snack before bed may improve your sleep and prevent middle of the night awakenings in which you wake up hungry.
The key is what you eat, and how much you sleep.
Dr. Michael Breus, best-selling author of the Sleep Doctor's Diet Plan, recommends a 200 calorie snack that is balanced with carbs and proteins; a good example is a piece of toast with peanut butter, or half an apple and cottage cheese. Sleeping 6-8 hours is also an important part of this plan.
Why?
Not getting enough sleep (re: 7-9 hours each night) can actually increase your appetite and the desire to overeat, leading to further weight gain, thereby creating a vicious cycle of sleep deprivation, eating, and weight gain.

On top of that, one recent study found that after two nights of only 4 hours sleep, the perception of hunger and the size of appetite increased over 20% for subjects.
Many people avoid eating after dinner because of the belief that it will lead to weight gain. However, if you add a before-bed snack and get enough sleep, you may actually lose weight rather than gain it. A 2009 study found that 7 out of 8 women lost between 3-15 lbs in 8 weeks just by sleeping more!
Covering the bases here, some people get up in the middle of the night to eat while they are still technically asleep. Often, this behavior isn’t remembered although some vividly remember it afterwards.
This sleep disorder is actually a variation of sleepwalking. Sleep eating is not caused by hunger or by habit, but is a complex psychological condition. Sleep eating can affect your health negatively over time, as most sleep-eaters overeat, consume high sugar foods, and sometimes injure themselves in food preparation.
If you think you have been sleepeating, consulting your medical provider is the first step to stopping the behavior. Sleep specialists often recommend ways to improve sleep health and diet, as well as prescribe pharmaceuticals that reduce the chance of this sleep condition.