It’s a myth that eating right before gong to bed is unhealthy or will cause weight gain. There’s nothing wrong with a bedtime snack. Of course, at bedtime it is best to avoid coffee, tea, colas or any other beverage containing caffeine, since that can keep you awake. Chocolate contains caffeine as well, but unless you are very sensitive to it, you would have to eat a lot to get the amount of caffeine in coffee or tea. However, if you have trouble sleeping, it’s best to avoid all sources of caffeine late in the day.

Rubin Naiman, Ph.D., a psychologist and author who specializes in integrative sleep and dream medicine and is on the faculty of the Arizona Center for Integrative Medicine, advises that it is best not to go to bed either full or famished. He generally recommends an easily digested snack that includes a small portion of complex carbohydrates. Dr. Naiman said that the common tendency to eat protein in order to increase levels of tryptophan, a precursor to melatonin, can backfire, adding that tryptophan competes with larger amino acids in protein for passage through the blood brain barrier, and that complex carbohydrates make it easier for tryptophan to reach the brain.

In general, it’s important to keep your bedtime snack light. Eating too much food before bed may satisfy your hunger, but it can also cause stomach discomfort and rob you of sleep. Bear in mind that the digestive system slows down during sleep, so your body may not be able to efficiently handle a hefty snack. Too much food before bed can also worsen heartburn, as food or drink backs up from the stomach into the esophagus.

Good sources of tryptophan include cheese, chicken, eggs, fish, milk, nuts, peanut butter, peanuts, pumpkin seeds, sesame seeds, tofu, and turkey. You could munch on some nuts, or have some whole grain crackers with peanut butter or cheese for your snack. Because protein can be more difficult to digest, if you opt for a slice of chicken or turkey, keep your portion small.

I would also advise avoiding sweets – a sugar jolt can ruin your sleep, and on a personal note, I find that that if I eat something sweet close to bedtime, I wake up at my regular time in the morning feeling really hungry.

While checking up on bedtime snacking, I came across a study from the Netherlands published in 2012 showing that a snack consisting of 40 grams of casein (a milk protein) consumed about a half an hour before sleep by young healthy men who had done resistance training earlier in the evening was effectively digested and absorbed. The researchers reported that the protein in the snack stimulated muscle protein synthesis and improved whole-body protein balance during overnight recovery from exercise compared to a placebo. If you’ve been working out and are not allergic to milk protein, you might get the same recovery effect by snacking on some cottage cheese, which also contains casein.