I have trouble sleeping off and on myself. In my case it's usually down to anxiety and stress - I can't get my brain to "quiet down" and stop running through everything I have to do or worrying about things I might have forgotten to do, etc. Sometimes if I'm having a depressive period as well, brain keeps running dark or negative thoughts round and round, I end up getting into a very emotional state which also keeps me from sleeping. If that's your situation as well, I recommend mindfulness meditation! It's surprising how much work it takes to STOP thinking all the time and just be; it actually takes some practice to do. And mindfulness meditation makes you practice it. Of course the goal of mindfulness meditation is usually to become more aware, not less (i.e. not fall asleep) but I find that the techniques you learn for clearing your mind and focusing on something calming, like your breathing, are really helpful for sleep.
Another thing is, are you getting tired enough to be able to sleep well? A lot of us actually aren't active enough during our days - especially if we have desk jobs or aren't getting out much - to get the body to a point where it feels like it "needs" to sleep at a certain time. The brain may be tired but the body isn't. So maybe getting some more activity during the day could help. Doesn't have to be strenuous or sporty, just something that uses energy. Walking is my personal favorite, or else calisthenics type videos done in my living room with the curtains shut - but really anything you like to do that gets you moving!