That's the reason why.. I take it you're constantly thinking about your ex? Or what happened?
Try not to go to the gym 2-3 hours before your usual bedtime. No coffee, tea, softdrinks, nor juices after dinner. Try to unwind first, you can take deep breaths while just thinking about the color blue. You can watch tv, but not those dramas. You can also try to drink warm milk. As calcium helps to relax the body.