He was acquired by the Padres from the A's in the trade that sent outfielder Kyle Blanks to Oakland in May 2014.
Herrera is 23-24 lifetime with a 3.79 ERA in 82 games (74 starts) spanning four Minor League seasons.
Pirela, 25, hit .230 with a homer and five RBIs in 37 games with the Yankees this past season. He missed the first month of the season while on the concussion disabled list following an injury sustained during a March 22 Spring Training game.
In 64 Minor League games between Class A Advanced Tampa, Double-A Trenton and Triple-A Scranton/Wilkes-Barre, Pirela hit .