Reliever Sergio Romo and the San Francisco Giants have agreed to a $9 million, two-year contract, avoiding salary arbitration.