The four-time champion has been at the team since 2015 and has helped build them up to be title contenders this year after a difficult few seasons.
Vettel is leading the championship by 14 points from Mercedes driver Lewis Hamilton with nine races remaining.
The move ends speculation that the 30-year-old could be considering a move to Mercedes in the near future.
A statement from Ferrari said the team had "extended its technical and racing agreement" with Vettel "for the 2018, 2019 and 2020 racing seasons of the F1 world championship".
In Ferrari's time-honoured style, the statement contained no quotes or further information from the driver or the team.
Ferrari announced earlier this week they had retained Vettel's team-mate Kimi Raikkonen for one more season.
Vettel had made it clear his preference was for the Finn to stay.
Vettel's decision is likely to be followed by confirmation from Mercedes that they will retain Valtteri Bottas for at least another season alongside Hamilton.
The Finn was signed on a one-year deal to replace world champion Nico when after the German retired from F1 after winning the title last year.
Hamilton is contracted to Mercedes until the end of 2018.
Later, after qualifying second to title rival Lewis Hamilton's Mercedes, Vettel said: "I love this team and the people who work for this brand," adding: "In a way, it was a no-brainer to continue. We haven't yet achieved what we wanted to achieve. But things are looking pretty good and obviously we have a long road ahead of us."
Asked whether he had talks with Mercedes over the summer, he said: "I have been around in the paddock for a while so I know people and it's only natural you talk, but it has never been more than chatting," he said. "I have been talking for a while with Ferrari. My intention was to stay."
Mercedes F1 boss Toto Wolff said: "There were zero discussions with Sebastian about a contract."
Vettel added that he had signed the deal at this weekend's Belgian Grand Prix and talked of the inspiration he has following in the footsteps of his childhood hero Michael Schumacher.
"We haven't succeeded. The mission is still ongoing. I want to win in red. We talked about inspiration earlier, about Michael, who was mostly dressed in red, he won most of his races and championships in red.
"I don't want to step in his footsteps. The whole generation of the Ferrari team today was to leave their own footsteps but certainly there is a huge inspiration. Something that for me is now the biggest challenge and dream I have. It's what I want to achieve."
Sebastian Vettel has signed a new contract to stay with Ferrari until the end of 2020.