Stephen Watson had been out drinking in the West Lothian town of Armadale before returning to the house where the schoolgirl was sleeping.
Watson, 22, left the house after sharing two bottles of wine with another man but later claimed to police he decided to return because it was too cold to walk further.
He got into bed beside the girl who recalled waking up and smelling drink from him before he molested her and started to have sex with her.
Watson, formerly of Glencorse Barracks, Penicuik, Midlothian, admitted assaulting and raping the girl on February 21 last year.
A judge told him at the High Court in Edinburgh: "I have no doubt these events have had a devastating effect on this girl."