The San Francisco Giants have reached an agreement on a one-year, $4 million contract with Ryan Vogelsong, according to a baseball source.

Vogelsong, 37, is 49-57 with a 4.42 ERA in 10 seasons with the Giants and Pittsburgh Pirates.

The right-hander was close to an agreement with the Houston Astros earlier this week before changing course and electing to return to San Francisco.