Foods That Can Cause Insomnia. If you do not get quality sleep at night, take a look at your diet to see if the food you are consuming is the reason for your insomnia. Spicy foods, desserts, chocolate, soda and coffee are some food items that affect sleep. Common reasons for insomnia include consuming caffeine, and food sensitivity or food allergy. Caffeine stimulates the nerves, which is great for activity during the day. But, if consumed before bedtime, it can affect sleep. Some common caffeine carrying items include tea, cough and cold medicine, soda and coffee.