Reliever Giovanny Gallegos and the Cardinals agreed Monday to an $11 million, two-year contract, a deal that includes a club option for 2025 and escalators that could make it worth $20.5 million over three seasons.