The deal assures the Rockets of one additional year of Harden under contract in 2018-19 because of a player option that could return him to free agency in 2019, league sources told The Vertical.
Harden's salary for next season will be $26.5 million under the new salary cap and increase incrementally over the course of the deal.
Rockets owner Leslie Alexander made the announcement at a news conference Saturday.
"There's no indecision," Harden said. "There's no doubt. There's new life.
"I'm happy to be here for four more years. This is home for me."
The 26-year-old Harden averaged 29 points, 7.5 assists and 6.1 rebounds for the Rockets last season.
Harden has been an All-Star in each of the four seasons he has played for Houston. He was traded to the Rockets in 2012 in a deal with the Oklahoma City Thunder and led Houston to the 2015 Western Conference finals.
The Rockets were ousted by the Golden State Warriors in the first round of the playoffs last season.