When you're dieting down especially with low carb diets the body begins to cannabalize muscle tissue which the body uses to synthesize glucose (gluconeogenesis). Most of the resulting amino acids EXCEPT phenylalanine (PA) are used. The remaining PA in ur blood has a stimulent efect which gives you that wired/tense feeling and often leads to insomnia (if you doubt this, try some PA supplements on an empty stomach).
When you have this problem at bedtime during a diet, try eating something, preferably some carbs (i know counter-productive for dieting) or even some protein (because PA competes with certain other aminos to cross the blood-brain barrier, and can only have the CNS stimulating effect if it successfully crosses the blood-brain barrier).