Stephen Thomas, 34 with no fixed address, has been sentenced to seven years in prison for trespass with intent to commit a sexual offence.
He has been told that he must serve at least two thirds of the sentence before he can be released.
The crime occurred in August last year.
The victim was attacked after she stepped out of the shower. She managed to escape and call for help.
The attacker had disappeared by her return, but he was spotted by one of her neighbors.
He has also been sentenced for two burglary offences and fraud.
Detective Constable Will Burnett, of Dorset Police’s Serious Sexual Offences Team, said: “Stephen Thomas subjected his victim to what must have been a truly terrifying ordeal in the very place she should have felt safe. I would like to pay tribute to her and the witness in this case for providing vital evidence that led to Thomas’ conviction and sentence.”
“Thomas poses a significant risk to the public and I hope this sentence will go some way to reassure his victims and the wider public that he is serving a substantial prison sentence.”