Thanks for your comment. I'm only 24 years old. I used to drink chamomile tea and it helped but I would have to get up to urinate in the middle of the night.
Sounds like anxiety about something, especially the frequent urination, unless you're an older man like me with an enlarged prostate. If you're going to try melatonin, you need to use it regularly. It resets the body clock, which doesn't happen in one night. Taking more of it doesn't help -- it actually works better in lower dosages. In other words, it's not a sleeping pill, it's a hormone you have naturally in your system that regulates your body clock, among other things. Other natural remedies you can try are herbs like valerian, passionflower, hops, and such, or minerals like magnesium, or amino acids like tryptophan. But to figure out why you're anxious, you'll probably need talk therapy. As to why they occur when you go to bed, trying to figure out anxiety is like trying to grab a handful of air. One reason could be that it's when you have unobstructed time to obsess, but who knows?