Yeah, the being awake and not moving thing is definitely sleep-paralysis. It's happened to me a few times. I usually panic and muster out a groan or something to snap out of it. (While it's happening I feel like I can't really talk either.)
The looping thing's kinda weird, but I had something somewhat similar happen to me one time. Basically, I realized I was dreaming, (I was Duke Nukem on jetpacks) and I felt like I was ready to wake up, but I just didn't know how...I just remained stuck in the dream for a few minutes until I somehow snapped out of it. It didn't last long but it was kinda terrifying not waking up at will.
Anyway, I'm not sure how this sort of thing could be managed (if at all) OP. But, I'd imagine keeping a regular sleep cycle would help.