Ambien During Pregnancy - Safe? (Kinda long)

I'm a FTM at 6w. Prior to learning of my pregnancy, I'd been taking Ambien. My PCP told me to take the Ambien only "as needed" for the remainder of pregnancy, if I found I really needed it. 
Well, problem is I do need it! I've tried NOT taking it and I've tried to reduce how much I take, but I absolutely can't fall asleep. I haven't slept in days and I'm getting desperate. 
What are the risks exactly with taking Ambien during pregnancy? Are there any other sleep meds considered safer?