What you describe is a combination of a sleeping disorder and an eating disorder. It's called "nocturnal eating syndrome" or NES if you wake up and can't fall asleep again unless you eat something. Alternatively, Sleep-Related Eating Disorder (SRED) describes a condition characterized by sleepwalking into the kitchen and eating while still asleep.
It is estimated that between one and three percent of the population is affected with these disorders, and up to 15 percent of all of those with eating disorders report sleep-related eating. While this condition isn't widely known, it has been around a long time. In the 16th century, two nuns who eventually became saints (Saint Veronica and Saint Mary Magdalen de'Pazzi) suffered from it. Both did a lot of religious fasting, and made up for it later by gorging at night, in their sleep. More recently, sleep-related eating disorders have been seen among people who diet during the day and go to bed hungry. They may binge at night when sleep has dulled their decision-making capabilities.
Researchers from the Minnesota Regional Sleep Disorders Center have described a group of 19 patients who habitually ate while sleeping. Some consumed enormous quantities of food and didn't always stick to edibles. One woman woke up while trying to open a bottle of ammonia, which she was about to drink. Others discovered that they had eaten stuff they ordinarily wouldn't dream of putting in their mouths, including cat food and buttered cigarettes. Most of these patients had no memory of their nocturnal binges, but the evidence was there: food in the bed, on nightclothes and in the kitchen, and supplies missing from the refrigerator.
These disorders are more common among women than men, but they do occur in both genders. In some cases, night eating syndrome is a side effect of the sleeping pill Ambien. Since 2007, the drug has carried an FDA-mandated warning that eating while “not fully awake with amnesia for the event” can occur. This is listed under "Important Safety Information" on the package insert.
I would recommend seeking treatment at a sleep-disorders center. You can probably find one near where you live by contacting the American Sleep Association (www.sleepassociation.org). Taking sleeping pills is not recommended (some may have the same side-effect as Ambien) and may cause confusion that could lead to injury.
Andrew Weil, M.D.