BALTIMORE — Brett Gardner had four hits, homered and drove in three runs Monday night to help the New York Yankees beat the Baltimore Orioles 10-2 for a doubleheader split.

In the opener, Danny Valencia snapped an 0-for-25 skid with a three-run homer off CC Sabathia, and Baltimore ended a six-game losing streak with a 5-4 victory.

The split left the Yankees with a 4-4 record against Baltimore and dropped them 2½ games behind first-place Boston in the AL East.

The first game ended with Gardner grounding out as a pinch hitter with the tying run on third base. He returned in the nightcap to torment the Orioles at the plate and in center field, where he made several fine running catches.

Gardner led off with a single off Yefry Ramirez (0-3) and scored on a double by Didi Gregorius. In the fourth, Gardner hit his seventh homer, a two-run drive that made it 3-0.

In the first game, Baltimore trailed 4-2 in the sixth when Sabathia (6-4) walked Mark Trumbo and yielded a double to Jonathan Schoop. With the New York bullpen buzzing in an effort to get a reliever ready, Sabathia served up a 2-1 pitch that Valencia drove far over the center-field wall.

RAYS 10, TIGERS 9: Daniel Robertson hit an RBI single in the 10th inning and Tampa Bay won for the 12th time in its last 13 home games.

Kevin Kiermaier had a one-out triple off Blaine Hardy (3-2) in the 10th. After Matt Duffy walked, Robertson won it with his hit to center.

Matt Andriese (2-3), the eighth Tampa Bay reliever, worked a scoreless 10th.

ATHLETICS 2, ASTROS 0: Frankie Montas and two relievers combined for a five-hitter, Stephen Piscotty homered and hit an RBI single, and Oakland won at Houston.

Houston starter Gerrit Cole struck out 11 and scattered three singles across six scoreless innings before Brad Peacock (1-4) took over for the seventh. Piscotty, who finished with three of Oakland’s six hits, greeted him with his home run to left field to make it 1-0. He added a run with a single in the eighth.

NATIONAL LEAGUE

PHILLIES, METS SPLIT: Aaron Nola allowed one hit in seven shutout innings and lashed a three-run double that sent visiting Philadelphia past New York 3-1 for a split of their twi-night doubleheader.

Nola (12-2) struck out 10 and won his sixth straight decision to become the only 12-game winner in the National League. With his teammates scuffling at the plate, he took care of the offense himself by doubling his career RBI total in the fifth.

In the opener, Wilmer Flores connected for a pinch-hit homer in the bottom of the 10th to give New York a 4-3 victory.

PIRATES 6, NATIONALS 3: Gregory Polanco drove in four runs in the first two innings and Pittsburgh won at home.

Polanco hit a two-run double in the first as the Pirates started the game with four straight hits, then added a two-run homer in the second, his 13th of the season to extend the lead to 6-1.

MARLINS 4, BREWERS 3: Backup catcher Bryan Holaday hit a walk-off single with one out in the 10th inning, and Miami won at home.

Holaday, who came into the game batting .165, was in the lineup because the Marlins placed catcher J.T. Realmuto on the paternity list before the game in anticipation of the birth of his first child.

INTERLEAGUE

REDS 7, INDIANS 5: Anthony DeSclafani allowed one run in seven innings, Scott Schebler was 4 for 5 with a homer, and Cincinnati won at Cleveland.

Joey Votto homered for Cincinnati, which took the opener of the team’s annual battle for the Ohio Cup and sent the Indians to their third straight loss.