The forward had hoped to return to Melbourne but the Swans' failure to negotiate a trade for O'Keefe during the player exchange period meant he had to choose between entering the pre-season draft or remaining in Sydney.
O'Keefe said that while he wanted to be traded to a Melbourne team to be close to his family "it wasn't to be and I'm more than happy to remain at the Swans, to be with my mates and to live in Sydney.
"I've moved on now and my focus is very much on next season and getting the best out of myself.
"For my part, I'm relieved and looking to repay the club and Swans supporters for the faith they have shown in me," O'Keefe said.
Coach Paul Roos said, "We're really pleased Ryan has chosen to stay with the club.
"We've always rated him as a quality player – an All-Australian – and we're delighted he will be lining up with us again next year. I think the last few weeks have been difficult for everyone, so we are pleased that today's news provides some closure to the matter.
"We'll be sitting down with Ryan over the coming weeks to resolve the detail but look forward to having him join us on November 17 for pre-season training."