Convicted rapist William Belk attacked the victim in her home in Edinburgh after she had invited him and friends back to her address where they were drinking.
After the others left she fell asleep on a sofa but woke to find Belk standing over the couch preparing to sexually assault her.
Belk, 53, rubbed her breasts and molested her before exposing himself. He pinned her down at her shoulder and grabbed a cushion and put it over her face and attempted to rape her.
But the hysterical woman screamed, kicked and struggled against her attacker during the attack in June.
The distressed victim phoned police and officers on patrol stopped Belk nearby in the city's Clovenstone area.
He told them: "I knew you were coming. My name is William Belk and I'm an RSO (registered sex offender). I tried having sex with her and I pinned her down."
Belk was given a 15 year sentence in 2003 for rape and has previously been convicted of assault with intent to ravish and breaching sex offender registration requirements.
Jailing him at the High Court in Edinburgh, Lord Uist said Belk was assessed as presenting a high risk of harm to the public and a report prepared on him said he had a "pervasive and persistent history of using sexual violence towards females".
Lord Uist said: "You have described yourself as a sex maniac and expressed a compulsive need to be sexually violent towards females.
"It is clear to me you are a very violent and highly dangerous man."
A risk assessment report on Belk stated that he held "entrenched attitudes and beliefs towards females which devalue and degrade them” .
The judge imposed an Order for Lifelong Restriction on Belk and ordered that he should serve a minimum of three and a half years in jail .
Lord Uist told him: "You will be released only when it is considered it is no longer necessary for the protection of the public that you continue to be confined in prison."
Advocate depute Steven Borthwick said Belk's latest victim had been unable to push her attacker off because he had pinned her down.
Belk told her afterwards that she should phone the police and that if she did not he would do it himself.
He said he wanted to return to prison after being freed 18 days earlier from a jail in England.
During an interview with police Belk told officers that he put a cushion over his victim's face with the intention of keeping her quiet during the attack.
Belk earlier pleaded guilty to assaulting the woman at her home on June 9 this year by touching her breasts, taking his trousers down and trying to take hers down, pinning her down and struggling with her, placing a cushion over her face, sexually penetrating her and attempting to rape her.