The agreement was struck hours before the scheduled start of a salary arbitration hearing in Phoenix.
"We agreed to the deal because we believe in Nate and believe we're going to feel as strongly four years from now as we do today," general manager Neal Huntington said. "We get cost certainty as we move forward. The player certainly gets the security of the money that's coming his way. He can go out and relax and play and we can build around him."
McLouth hit .276 last season with 26 home runs and 94 RBIs. He was on the NL All-Star team and won a Gold Glove in center field.
He gets a $1.5 million signing bonus and salaries of $2 million this year, $4.5 million in 2010 and $6.5 million in 2011. Pittsburgh has a $10.65 million option for 2012 with a $1.25 million buyout.
In addition, he can earn up to $1.75 million in escalators. For 2011 and 2012, his salary could increase by up to $500,000 annually: $200,000 if he was an All-Star the previous year, $200,000 if he was a Gold Glove winner the previous year and $100,000 if he was a Sliver Slugger winner the previous year.
For the option year, the amounts would be $300,000 each for All-Star and Gold Glove the previous year and $150,000 for All-Star the previous year.
McLouth was eligible for arbitration for the first time after making $425,500 last year. When players and teams exchanged proposed arbitration salaries last month, he asked for $3.8 million and the Pirates offered $2.75 million.
McLouth was flying back to the Pirates' spring training camp from Phoenix and was unavailable for comment Tuesday.
McLouth is the third player to sign a multiyear deal with the Pirates this offseason. Pitcher Paul Maholm got a three-year, $14.5 million contract in January and catcher Ryan Doumit got a three-year, $10.7 million deal in December.
"I think it shows they see the guys they want, who they can hopefully build around and turn it around," Maholm said.