Have you tried benadryl? It's safe during pregnancy.
I had the same problem in early pregnancy. My doctor prescribed me unisom which is actually for morning sickness but also helps her tired and stay asleep. Ask your doctor about a prescribed sleep aid. Melatonin did not work for me.
Just ask your Dr about continuing a low dose of the melatonin.
You could try tylenol pm or unisom. With my last pregnancy doc prescribed the lowest dose of ambian possible. Good luck