The former world player of the year has been the subject of intense speculation in recent months linking him with a lucrative move to the Top 14.
But Williams, currently sidelined with a knee injury, has reaffirmed his commitment to the Welsh region.
"I'm going to finish my career in Wales by signing a new two-year contract with the Ospreys that will be the last I sign as a player, unless something extraordinary happens," said 34-year-old Williams.
"I'm really happy there, it's a family in itself for me, it's close to home and I still want to achieve things with the Ospreys.
"Nothing is signed yet and I'll have to see if the still want me with my crooked knee as well!
"But I've sat down with the senior people there and agreed terms, I'm chuffed to bits. Hopefully I will be signing in the next couple of weeks which will take me to the end of my professional career."
The news will be a major boost to the Ospreys who have already lost three former Lions. Gavin Henson, a tourist in 2005, joined Saracens in October and is now contracted to Toulon.
While 2009 Lions James Hook and Lee Byrne have signed deals to join Perpignan and Clermont Auvergne at the end of the season.
And Williams has revealed the prospect of leaving his home region was never a real option.
"I never really wanted to follow the likes of Hook, Byrne and Gavin Henson by going out there," added Williams.
"Staying at the Ospreys was always my preferred option."
Williams is expected to be out of action for another seven weeks. That would give him a slim chance of returning for the Ospreys for the end of the Magners League season.
But he will be hoping to make his international comeback during Wales' World Cup warm-ups in the summer before drawing the curtain on his illustrious career after the show-piece tournament.