NEW YORK, N.Y. - The Marlins' recently steady bullpen gave up everything — but Alex Rodriguez's 3,000th hit.

Sam Dyson brushed back A-Rod with four straight pitches in the slugger's final attempt Thursday night at the milestone, then allowed four runs in Miami's 9-4 loss to the New York Yankees.

Mike Dunn (1-4) gave up the tiebreaking two-run homer to Carlos Beltran in the seventh as the Marlins lost both games of a four-game, home-and-home series in New York after taking the first two in Miami.

"For the first time in a long time, we didn't get the job done with the bullpen," manager Dan Jennings said, "and they added on some runs there and just created too big of a mountain for us to climb."

The Marlins took a 3-1 lead against CC Sabathia in the sixth inning behind another long homer from Giancarlo Stanton, but Miami relievers, who had allowed just one run over 14 1/3 innings in the last week, yielded six runs in 2 1/3 innings Thursday.

The pitches that got the biggest jeers, though, came before the Yankees even scored in the four-run eighth.

With Rodriguez at 2,999 hits after singling twice in his first four at-bats, he was set to face Dyson with one on and none out.

Yankee Stadium speakers blared with a piece of Beethoven's famed Symphony No. 5 as Rodriguez came to the plate with nearly all of the 38,239 cheering fans rising to their feet, camera phones flashing.

"The fans just want to see the players do well, that's the bottom line, and he has done well," manager Joe Girardi said in explaining the support for Rodriguez. "Sometimes people pull for people to fight back and get back up, when they've been knocked down."

But Dyson didn't give A-Rod a chance to swing, throwing four inside pitches that sent the slugger leaping back each time.

"I threw him four fastballs inside. That was the sequence," Dyson said. "If he was gonna beat me he was gonna have to get the head out. I ended up throwing four balls kind of at his belt, not the plate."

The boos got louder with each pitch and turned to vulgar chants aimed at Dyson that lasted until he was lifted three batters later, following Chris Young's RBI double.

"It is what it is," Dyson said of the jeers. "I tried beating him with my best stuff."

The Yankees made every effort to get Rodriguez one more shot at the milestone, sending six men to the plate after his walk. Brian McCann had an RBI single and Stephen Drew added a sacrifice fly in the inning.

"You know what? He may have been a little amped up," Jennings said. "He was just missing inside to A-Rod and he just let it get away a little bit."

Rodriguez hit an RBI single in the first inning for the second straight night, flied out to right field in the third and hit a sharp grounder past diving third baseman Donovan Solano in the fifth to move within one hit of becoming the 29th player to reach the 3,000 plateau.

He lined out in the sixth, his first try at the milestone — swinging at specially marked balls.

"I don't even know how to describe it," Rodriguez said. "It feels great."

Brett Gardner hit a two-run shot that chased Mat Latos in the sixth to tie it at 3. Beltran homered and inning later to tie it.

Chasen Shreve (4-1) gave up a hit in one inning for the win.

A night after being no-hit into the seventh by Michael Pineda, Gordon tripled for Miami's first hit off Sabathia leading off the seventh. He scored on Christian Yelich's groundout to tie it 1-all.

The Marlins then went ahead in the fifth on Jeff Mathis' sacrifice fly. Stanton's homer to left field in the sixth made it 3-1.

Stanton has 13 homers in his last 23 games.

"It just shows you how special he truly is," Marlins manager Dan Jennings said. "On any given swing, he can leave the ballpark. We're watching him become more of a complete hitter."

In his second start since coming off the disabled, Latos gave up nine hits and three runs in 5 2/3 innings.

TRAINER'S ROOM

Marlins: INF Martin Prado (right shoulder) was put on the DL, retroactive to June 15. Manager Dan Jennings said Prado worked out in Florida, but is still too sore. ... RHP Jarred Cosart (vertigo) is going to make one more rehab start before a likely return to the Marlins, for Double-A Jacksonville on Sunday at Chattanooga.

UP NEXT

Marlins: RHP Dan Haren (6-3) faces the Reds. He has struggled at Great American Ballpark in Cincinnati, with a 5.59 ERA in six games, five starts.

Yankees: RHP Adam Warren (4-4) starts against the Detroit Tigers. Warren has a 2.81 ERA in his four losses.