Massa, 32, has raced for the team since 2006. He came within a point of winning the title in 2008.
"From 2014 I will no longer be driving for Ferrari," the driver said in a post on Instagram and Twitter. "I would like to thank the team for all the victories and incredible moments experienced together.
"Thank you also to my wife and all of my family, to my fans and all my Sponsors. From each one of you I have always received a great support!"
Massa insists that he is focused on the final seven races of the season and wants to stay in the championship in 2014.
"Right now I want to push as hard as possible with Ferrari for the remaining 7 races. For next year, I want to find a team that can give me a competitive car to win many more races and challenge for the Championship which remains my greatest objective! Thank you all. Felipe"
Massa's departure opens the way for Finland's Kimi Raikkonen, who has been widely tipped to return to the team with which he won the 2007 world championship before making way for Fernando Alonso at the end of the 2009 season.
Massa at Ferrari
Massa joined Ferrari at the start of 2003 as their test driver, having had an erratic debut season for Sauber in 2002. The Brazilian returned to the Swiss team for two seasons before stepping up to Ferrari in 2006 as understudy to Michael Schumacher. He claimed his breakthrough win in Turkey and followed it up with another success at his home race in Brazil. 2007 yielded more victories but he ultimately had to play fiddle to Raikkonen. The roles were reversed a season later when Massa came within a few seconds of claiming the world championship.
The turning point appeared to come in 2009, when the Brazilian suffered a near-fatal accident during qualifying for the Hungarian Grand Prix. He returned in 2010 but after the infamous 'Fernando is faster than you' message in Germany, Massa rarely challenged for podiums, let alone victories. He failed to secure a single top four finish in 2011 and took until Japan last year to return to the top three. This season he has claimed just a single podium when he finished in third place in Spain.
During his 132 race spell with Ferrari, Massa has won 11 races, taken 36 podiums, 15 poles and 14 fastest laps.
Massa's Formula 1 future looks uncertain. Top teams such as Mercedes, McLaren and Red Bull have already set their line-up for 2014, while Lotus is set to sign Nico Hulkenberg, should Raikkonen indeed be replacing Massa. A long shot would be a return to Sauber, although current racer Esteban Gutierrez is likely to be partnering Sergey Sirotkin.