Castro, 27, had a 3.45 ERA over a career-best 69 appearances last season, going 3-4 with 77 strikeouts in 70⅓ innings. He will make $2.62 million this season after signing a deal this month to avoid arbitration.
Rodriguez, 30, was traded from Texas to the Yankees last season and combined to post a 4.66 ERA in 52 appearances. He was sharp for New York down the stretch, going 1-0 with a 2.84 ERA in 21 games after the trade. He is owed $2 million this season.
The deal is the 18th between the franchises and only the third since 2005. The Yankees acquired right-hander Gonzalez Germen from the Mets for cash in December 2014 and got infielder/outfielder L.J. Mazzilli for outfielder Kendall Coleman in April 2018.