What happened

I often having trouble sleeping for years I’ve had dreams of me feeling weird and I shake my leg and waking up but today. I was laying in the couch trying to fall asleep and I heard everything in the background. I just noticed me talking to myself in the head and then boom I see me falling asleep instantly. Like I blacked out while that happened I felt like my brain was shutting down. Me being sleeping but knowing I’m up. Then I just thought I was dying and I asked god to wake me up then I did. I’m kinda scared to go back to sleep. Any one know what this is?