For a decent chunk of my early 20s i had to take amitriptyline a couple of hours before bedtime to prevent migraines. It also makes you sleep on cloud 9. I was on call at nights and there was no snapping out of the sleep pull, thats the only scenario I can think that it may not help.
Talk to a doctor about it. I have had a couple of brain scans and don’t have anything up there that looks bad. It just happens to some people.