At the end of 2009, he was granted free agency by the A's and signed a minor league contract with the San Francisco Giants for 2010. He made his Giants debut on May 21, 2010 against his former team in Oakland and remained with the team for the remainder of the season until they won the World Series. He returned to the Giants for 2011 as a member of the bullpen and took over as its closer after Brian Wilson went on the disabled list in August.