I've had similar bouts with insomnia - very discouraging at times - and found the following to have more or less solved the problem:
1. Virtually eliminate caffeine - I may have a cup of coffee early in the day but that's it. Used to drink coffee and diet Coke throughout the day - no more.
2. Cut out weekday alcohol. Or, recognize that if I have a couple drinks in the evening, I asking for it in terms of a restless night.
3. I don't eat after 7-8. If I miss dinner for whatever reason, I skip it and look forward to a great breakfast. When comes to dinner, I go for something lighter, with a focus on fruits, veggies and lean meat.
4. I exercise every morning.
Depending on how my day is going, I find myself mentally planning my evenings mid-afternoon. How late will I work, what are the required family or social activities for the evening that might impact the above.
When I first started the above routine nearly five years ago, I thought to myself, how utterly boring my evenings will become. Evidently that is the point and by my old standards they are. But I can sleep and sleep well.