Working out too close to the time you go to sleep can actually keep you awake. Working out earlier does help, though.
Try to have some kind of routine before you go to sleep, and try your best to always go to sleep and wake up at the same time every day. Reading a book while sitting in bed can help sometimes. Whenever I can't sleep, it's usually because I can't get my brain to "stop working", so to speak, so I have to focus on clearing my head.