It's late, so apologies if this is a bit, well you know a bit...
Our DS asd 2.5 has been on melatonin for 8 months. Made a difference, helped to get him to sleep at night, which had been problematic. But we had a similar problem with him waking in the middle of the night.
The first thing to say is that we get melatonin capsules - they're an unlicensed drug - which appears to mean very little in reality. Our paed gives us those specifically, as our DS would never tolerate a tablet. We break the capsules open, mix them with orange juice, and use a sryinge to administer. Works a treat.
The second thing is that I spoke at length to our paed about the waking in the middle of the night. His thinking was twofold:
Firstly, if melatonin helps to get him to sleep, it will help to keep him asleep. So if he wakes at 4 give him another dose, your body naturally produces melatonin until 6'ish (I think!) anyway. If he's awake at 4am help him back to sleep.
The other thing he mentioned was that we shouldn't give him any positive reinforcement - no talking, stroking, soothing etc. I think we would have found this difficult, except for the fact that we're now just waliing in, giving him his melatonin top up and walking out again - he may mutter for a while, but he eventually gets back to sleep, and we don't have the screaming that we used to have.
It's a fairly new routine - last six weeks or so, and I don't want to tempt fate, but he's slept through the odd time, and he's such a different child through the day. He still has a nap, and he's waking much brighter from those - we've realised that he's now having a nap rather than catching up on sleep he missed through the night.
Sorry, late night rant. Hope it's helpful.