SAN FRANCISCO (AP) -- Javier Lopez found a nice fit in San Francisco from the moment the Pittsburgh Pirates dealt him to the Giants at the 2010 trade deadline.
It hasn't hurt he won a pair of World Series championships.
The free agent left-hander reached agreement on a $13 million, three-year contract to stay with the Giants. The deal is pending a physical, likely to take place next week, assistant general manager Bobby Evans said Thursday.
''I am happy to be back in San Francisco. It's the place that my family and I have come to love,'' Lopez wrote in an e-mail. ''The Giants organization has been first class since I was first traded in 2010. The fans especially have been welcoming not only to me but all of my teammates and their support is unmatched in the major leagues. They make for a wonderful place to come and work.''
Lopez agreed to terms two days after San Francisco gave right-hander Tim Hudson a $23 million, two-year contract.
The 36-year-old Lopez went 4-2 with a 1.83 ERA in 69 appearances and 39 1-3 innings this year, when the Giants missed the playoffs one season after winning their second World Series in three seasons. Lopez just completed an $8.5 million, two-year contract signed that paid him $4.25 million each season.
San Francisco acquired Lopez in a swap that sent John Bowker and Joe Martinez to the Pirates, and Lopez emerged as a reliable option for manager Bruce Bochy as the club made an improbable run to the city's first World Series championship since moving West in 1958.
Signing Lopez to a multiyear deal will give the Giants two lefties in the bullpen for the next two seasons. Jeremy Affeldt received an $18 million, three-year contract last November.
In addition, starters Madison Bumgarner and Matt Cain are signed long term, along with 2012 NL MVP and batting champion catcher Buster Posey. Two-time NL Cy Young Award winner Tim Lincecum landed a $35 million, two-year deal late last month.
''I'm excited for the future of the black and orange,'' Lopez said.