Boston's Rob Refsnyder ripped a two-run double, Christian Arroyo had a two-run single and Reese McGuire added an RBI single for the Red Sox, who have scored 59 runs during their eight-game winning streak.
After Willie Calhoun popped out with two runners on, Bader put the Yankees ahead with a two-run single to right field.
He worked a perfect ninth inning, striking out two, to earn his first save.
Alejandro Kirk added an RBI double and Daulton Varsho an RBI single for the Blue Jays, who entered the series with a five-game losing streak.
Jack Suwinski homered and Connor Joe had an RBI single for the Pirates, who lost their sixth in a row.