I've had varying degrees of insomnia for a large portion of my life, but I feel it's gotten especially bad over the past couple of years or so and I'll regularly stay up until 2 or 3 in the morning, sometimes later. You would think getting up at the same time everyday(even weekends) would help me get to be on a more consistent schedule, but it doesn't seem to help much. I feel like it started getting really bad just because I had people I wanted to talk to and it seemed like late at night was when they were often most available. They were either in different time zones or had sleep schedules just as awful.
I'm now at a point in my life where I don't actually have any friends, or at least no close friends that I talk to on a regular basis, but my sleep still hasn't gotten any better. I find that I won't even attempt to lie down and go to sleep until I'm so tired that I absolutely can't keep my eyes open any more. I think this is because it often takes a toll on my mental health when I'm lying awake not able to fall asleep quickly. It's when I feel the most lonely, and often unwanted thoughts will go through my mind. When I was younger I used to use this time to try to brainstorm fanfic stories, even if they were things that I'd never end up writing. I still try to do this to some extent, but I can't focus as well on it.
I've tried several medications to try to help me get to sleep earlier(including melatonin which seemed to help but I'd build up a tolerance to it very quickly), but generally they were either too strong or didn't really help at all. There was never really any middle ground. If I took the ones that were too strong, then I'd be really out of it and not really able to stay awake until late afternoon the next day. Or sometimes I'd just be too groggy to do anything but not able to go back to sleep, and then I'd have the same problem with unwanted thoughts going through my head.
I haven't really tried drugs like Ambien or Lunesta(though I may have had Ambien once in the hospital) because my doctors were reluctant to prescribe them for some reason, so no idea if those would work. At this point I've kind of given up hope of ever having a normal sleep schedule, and since I'm disabled and can't work anyway, I find I don't have much motivation any more to try to fix it.