i take 3mg of melatonin every night for the last 2 years, never had any problems, i don't wake up at night, no heart issues, etc...
May i suggest that it is not melatonin that is waking u up 3hrs later, that is exactly when you should wake up when u have a cortisol spike.
You should try ashwagandha before bed, it is one of those herbs that has a double blind placebo controlled study that backs its effects, so you know it does work:
A Prospective, Randomized Double-Blind, Placebo-Controlled Study of Safety and Efficacy of a High-Concentration Full-Spectrum Extract of Ashwagandha Root in Reducing Stress and Anxiety in Adults
/www.ncbi.nlm.nih.gov/pmc/articles/PMC3573577/"By the end of the study period, the two groups’ average serum cortisol levels were considerably different (P=0.006). After 60 days of treatment, a reduction of 27.9% from baseline was observed in the Ashwagandha group. In contrast, a reduction of 7.9% was observed in the placebo-control group. The difference in the reduction of serum cortisol levels in the two groups on Day 60 was statistically significant"
Careful to stop it when your sleep regulates, it may affect the thyroid function if u take it for too many months.