The 35-year-old has agreed to partner Canadian teenager Lance Stroll in 2017 after Valtteri Bottas' move to Mercedes, Williams announced on Monday, reports Xinhua news agency.
"I always intended to race somewhere in 2017, but Williams is a team close to my heart and I have respect for everything it is trying to achieve," Massa said.
"Valtteri has a great opportunity, given the turn of events over the winter, and I wish him all the best at Mercedes.
"I certainly have not lost any of my enthusiasm for racing and I'm extremely motivated to be coming back to drive the FW40."
Valtteri's switch follows the shock retirement of Nico Rosberg in November, just days after he beat Lewis Hamilton to the world title.
After starting his Formula 1 career with Sauber, Massa spent eight years with Ferrari before joining Williams in 2014.
A veteran of 250 Grand Prix events, Massa has had 41 podium finishes and 11 victories.
Williams deputy team principal Claire Williams said: "Felipe has always been a much-loved member of the Williams family, and having the opportunity to work with him again is something we all look forward to.
"He was always going to race somewhere in 2017, as he has not lost that competitive spirit, and it was important that we had a strong replacement in order for us to let Valtteri go.
"Felipe re-joining us provides stability, experience and talent to help lead us forward. He is a great asset for us."