Yes, it is rape as everyone here has said.
Too long a story to give all the details, but one Christmas Eve I let a male friend stay over because I was so close to the pub a group of us had been drinking in and it was f cold. Supposed to sleep on my sofa but he said he was cold could he please, please sleep in my bed with me. I made it clear that we were just sleeping there was to be nothing else and also reminded him that he had a girlfriend. He wanted something more but agreed that there would be nothing, just sleep.
I woke up to feel his penis jabbing at me while he tried to pull down my pyjama bottoms - yes I was sexily clad in brushed cotton pyjamas - and had a shit fit. Threw him out of the room and back to the sofa which was frankly too kind of me, I should have thrown him onto the street, but I had a hammer under my pillow - I lived alone I wanted the hammer just in case because I was worried about burglars - and the next morning he pretended that it had all been just a jolly laugh.
I didn't do anything about it other than tell some mutual friends that I never ever wanted to see him again or be near him again. None of us treated it like attempted rape and I felt like it was my fault for giving into him sleeping in my bed, but I was wrong. Would I have gone to the police if I saw it then as I see it now? Very probably not, but what he did was try to rape me because like some/many men he had no notion of what consent is. You're in bed with someone then you can fuck them because you're in bed with them. It stays with you.
If something has happened to you, then yes, you were raped and please find someone to talk to, if there is no one you know then a rape crisis centre.