NEW YORK — Gary Sanchez hit a three-run homer and the New York Yankees beat the Baltimore Orioles for the 16th straight time this season, winning 6-5 Wednesday in their final meeting this year.

The Yankees went 17-2 against the O's, their most wins versus any opponent in a season since going 17-5 over the Kansas City Athletics in 1959. New York's winning streak is its longest against anyone in a season since a 21-game string over the St. Louis Browns in 1927.

Sanchez hit his 10th home run against the Orioles this year, capping a four-run burst in the first inning. He sent a 2-0 changeup from Dylan Bundy (5-13) over the center field fence on top of the netting above Monument Park with two outs to give New York a 4-1 lead.

The Yankees hit 61 homers off Orioles pitching this season and outscored them 151-83. Sanchez and Gleyber Torres (13 homers) joined Lou Gehrig and Babe Ruth as the second set of Yankees to hit double-digit homers against an opponent in the same season — Gehrig and Ruth each hit 11 against the Boston Red Sox in 1927.

New York, which began the day tied with the Dodgers for the best record in the majors, improved to 81-41 and moved 40 games over .500 for the first time since 2009.

Didi Gregorius hit an RBI single in the first and Mike Ford hit a two-run single in the sixth as the Yankees won their fifth straight.

Renato Nunez had five hits, including a two-run double in the seventh off Adam Ottavino, for Baltimore. Jonathan Villar drove in two runs for the last-place Orioles.

Baltimore dropped to 39-82 and with one more loss or Yankees win would become the first big league team eliminated from division title contention.

J.A. Happ (10-7) allowed two runs and six hits in five innings. He struck out six, walked two and did not allow a homer for the first time in six starts.

Bundy allowed six runs and five hits in 5 2/3 innings. He retired 16 of 17 hitters before consecutive hits by Sanchez and Torres finished him.

Ottavino struck out pinch-hitter Chance Sisco to end the seventh and Zack Britton pitched a scoreless eighth. Aroldis Chapman converted his 33rd save in 38 chances.

The Orioles lost for the ninth time in 10 games and allowed their 250th homer, extending the American League record. Baltimore is eight away from matching the big league record set by the Cincinnati Reds in 2016.

BULLPEN MOVES

Both teams made moves to add relief pitchers to their 40-man rosters.

New York claimed RHP Ryan Dull off waivers from San Francisco and designated RHP Brady Lail for assignment.

Baltimore claimed RHP Ryan Eades off waivers and optioned him to Triple-A Norfolk. The Orioles designated RHP Jimmy Yacabonis for assignment.

TRAINER'S ROOM

Orioles: OF D.J. Stewart (concussion) was to begin a rehab assignment with Norfolk Wednesday and was expected to be activated Friday.

Yankees: LHP CC Sabathia (inflamed right knee) will come off the injured list and start Sunday against Cleveland. ... 1B/DH Luke Voit (sports hernia) took grounders, hit in the cage and did some throwing. He could work out next week at the Yankees' complex in Tampa, Florida, or Triple-A Scranton-Wilkes/Barre.

UP NEXT

Orioles: RHP Aaron Brooks (2-6) opens a three-game series in Boston on Friday.

Yankees: New York will use an opener for the start of a four-game series Thursday against Cleveland.