The Giants have agreed to a four-year contract with Angel Pagan to keep him a part of their outfield.

Pagan will earn $40 million over the life of the contract, according to a source.

He batted .288 with eight home runs, 56 RBIs and a San Francisco-best 15 triples in his first season with the Giants.