Williams, 34, will then take on an ambassadorial role with the Welsh region for an initial two-year period.
Williams retired from Test rugby in December after winning 87 caps and scoring a Wales record 58 tries.
Williams' current Ospreys contract was not due to expire until the end of the 2012-13 season, but agreement has now been reached on a new arrangement.
In addition to his new Ospreys role, Williams will take up a similar post with long-term Ospreys partners the Cuddy Group, plus his media commitments and personal business interests.
Williams said: "My future with the Ospreys was never in doubt.
"Things like this take time to sort out, but I am just delighted that I'm going to continue being a part of the region I love, the Ospreys."
And Ospreys managing director Mike Cuddy added: "Shane has been a tremendous servant to the region throughout his long career, and I've no doubt whatsoever that he can be an even bigger success off the field than he was on it.
"I'm looking forward to working closely with Shane the businessman for the next 15 years, just as I have with Shane the rugby player for the last 15."
Williams was named the International Rugby Board's player of the year in 2008, while he was also a Test Lion, helped Wales win Six Nations Grand Slams in 2005 and 2008 and featured in three World Cup campaigns.
He made his Test debut against France during the 2000 Six Nations tournament, and toured with the Lions to New Zealand in 2005 and South Africa four years later.
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
The All Blacks Performance t-shirt is black with hints of blue from the training jersey. Very Cool.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!