Pittsburgh had signed Freese to a one-year, $3 million free agent contract in March.
The 33-year-old Freese is hitting .276 with 12 home runs, 49 RBIs, 54 runs scored, a .355 on-base percentage, .437 slugging percentage and .792 OPS in 107 games in his first season with the Pirates.
"David has been a consummate professional while producing offensively and playing solid defense at both third and first base to help this team win games," general manager Neal Huntington said in a statement. "We are very pleased to have the opportunity to extend that impact into future seasons."
Freese's average, on-base percentage and slugging percentage are his highest totals since the 2012 season as a member of the St. Louis Cardinals.
Since breaking into the big leagues in 2009 with St. Louis, Freese has hit .276 with 80 home runs and 397 RBIs in 828 games with the Cardinals (2009-13), Los Angeles Angels (2014-15) and Pirates (2016).
The Pirates have now signed three players to multiyear deals since the start of the 2016 regular season (Gregory Polanco, Francisco Cervelli and Freese).