The Roma captain, who has been at the Serie A club since childhood and has played over 500 games for them, signed the contract extension at a news conference in Rome, ensuring his stay in the Italian capital until the end of the 2015-16 season.
"It's what I and the club wanted, I thank them for giving me another chance to wear the shirt of the only team I've ever supported and ever loved," the forward said.
"I have another two years of responsibility and I know that we can do great things here.
"So far this season we've got off on the right foot, we have a manager who wants his team to play and demands respect, which we haven't had recently."
Totti, who turns 37 next week, has started the season in great form, and with Italy missing a classic number 10, there have been calls to recall him to the national side for next year's World Cup.
"I don't think about the national team. I'm thinking about doing well for Rome and from now until May I need to see how I am physically and psychologically. Should something happen I'm available."
The Corriere Dello Sport reported that the deal will be worth 3.5 million euros a year.
"There's not much that can be added to what has already been about Francesco. I'd like to thank Francesco for allowing me to stay" joked Roma president James Pallotta, who kissed Totti on both cheeks after the contract was signed.
The American, the target of criticism from fans after changing the club's badge and because he is not around enough, flew to Rome to finalise the deal.
"We always said that there was no chance of Francesco ever going anywhere else," Pallotta said. "He was always going to be staying here forever."