Edward Taylor later assaulted the woman and punched her in the head.
The High Court in Edinburgh heard the woman had gone on her first night out since the birth of her child, but became separated from friends.
Taylor, 27, and a friend offered to share a taxi and invited her to come in for a drink. The court heard she felt safe in their company and agreed.
Judge Lord Turnbull told Taylor: "You treated her as if she was an object to take advantage of for your own sexual pleasure and as if she was worthy of no form of dignity."
The judge told Taylor, of Drumchapel, Glasgow, that he accepted he had acted out of character.
Taylor had admitted raping and assaulting the woman in August last year.
Advocate depute Iain McSporran said the woman fell asleep on Taylor's bed and he then raped her. He then took indecent photos of the still-sleeping woman on his phone. The woman later awoke and got into a struggle with Taylor as he tried to get her out of his flat.
She later went to a neighbour's home and told her she had gone to a house where she fell asleep and was "battered by one of the guys" when she woke.
Defence counsel Geoff Forbes said: "He [Taylor] expresses sincere and abject apologies and profound regret."




