if you want to eat almonds before bed to determine if they affect your sleep quality, a 1-ounce (28-gram) serving, or about a handful, should be adequate. almonds are a source of melatonin and the sleep-enhancing mineral magnesium, two properties that may make them a great food to eat before bed.