Right-handed reliever Sergio Romo, who threw the last pitch of the 2012 World Series, has agreed to a two-year deal with the Giants to avoid arbitration.