His new deal will mean the 36-year-old Giallorossi captain will end his career at his all-time club.
"I want to thank the (Roma) president (James Pallotta) for this contract," Totti said in Friday's press conference.
"In the end, this is what we all wanted, the club and I.
"I want to thank him (Pallotta) because this new deal gives me the opportunity to continue to wear the only jersey that I have loved and been a fan of.
"I have two more years of responsibility and I know that in these two years we will be able to do great things."
The veteran Italian forward has reportedly accepted a 30 per cent pay cut and will earn 3.5million euros per season.
Totti, who made his Serie A debut with Roma in 1993 at the age of 16, holds the club's all-time appearance (681) and goalscoring (283) record.
"I am honoured that Francesco will remain with us," Pallotta added. "I want to raise our glasses for Totti and for Roma, for a radiant future."
The Rome-born Totti has enjoyed success at the capital club, having won one Serie A title, two Italian Cups and two Italian Supercups.
He also won the 2006 World Cup with Italy.
Roma currently lie top of the Serie A the standings alongside Napoli and take on city rivals Lazio on Sunday.