Been there , done that, fixed it.
Don’t lie awake in bed. If you’re not sleepy, get up, go downstairs and do something else until you are. Rinse and repeat. Even if you go to bed six times a night or stay up all night.
You need to constantly reinforce the association of bed = sleep or sex. Nothing else. Eventually your brain will get the message and your body will comply.
Bed does not equal TV, Music, iPad, eating crisps or anything else that is not traditionally associated with being in bed.
Lying awake in bed forms a new association of bed = insomnia and every minute you lie there stressing about exactly how little sleep you could get before you need to get up for work only reinforces this association and creates a vicious cycle of sleeplessness.