Updated

Marlins rookie Andrew Heaney says he is getting better, even if his ERA is getting worse.

Making his third career start Sunday, Heaney took a lead into the sixth inning before the Oakland Athletics rallied to beat the Marlins 4-3 and complete a three-game series sweep.

Heaney (0-3) gave up four consecutive two-out hits in the sixth, and the most costly was the last one, a three-run homer by Nate Freiman in his 2014 debut.

"This is a learning experience," Heaney said. "I feel like every time out I've gotten better. Hopefully I can have one where there are a lot more positives, and I'll be celebrating a win."

Heaney was ranked the best left-handed prospect in the minors when the Marlins recalled him June 16 from Triple-A New Orleans. He has given up three homers in 17 innings, and his ERA is 5.29.

But manager Mike Redmond praised the rookie's latest effort.

"He did a great job," Redmond said. "His command was spot on; he was moving the ball and changing speeds. He really just made one bad pitch, and Freiman took advantage of it."

The Marlins will have an off day Monday to lick their wounds after playing 17 consecutive days and going 5-12.

"We just played a great team," Redmond said. "We were in every single game and could have won all three. We just weren't good enough this weekend."

The AL West-leading A's, playing in Miami for the first time since 2003, came from behind in all three games. They won their fourth in a row, improved to 7-1 in interleague play and reached the halfway point of 2014 a season-high 21 games above .500 (51-30).

Tommy Milone (6-3) allowed two earned runs in seven innings to win his sixth consecutive decision, a career best. Closer Sean Doolittle was given the day off, and Ryan Cook pitched the final 1 1-3 innings for his first save.

Marcell Ozuna had a pinch-hit drive for his 14th homer, but the Marlins totaled only six hits and hit into three double plays. They had the best home record in the majors earlier this month, but have lost five in a row at Marlins Park.

"We're playing hard, man," catcher Jeff Mathis said. "We're right there. We're in all these ballgames, and even though we're coming up on the short end, we're battling and we're going to keep doing that."

Heaney was nursing a 1-0 lead with two out in the sixth when the AL West leaders made their move. Consecutive singles by Alberto Callaspo, Yoenis Cespedes and Josh Donaldson scored one run, and the 6-foot-8 Freiman pulled a pitch into the nightclub beyond the left-field fence.

A's manager Bob Melvin said Heaney lived up to his reputation.

"We know they are very high on him," Melvin said. "He was on his game, spotting fastballs and throwing just enough breaking balls to keep you off balance. You are just waiting for that one good pitch to hit, and Freiman got it."

Christian Yelich, back in the Marlins' lineup after being sidelined for 15 games by a back injury, made an impact with his first swing. He tripled off the wall to lead off the first inning, and when second baseman Callaspo made an errant relay throw, Yelich scored standing up.

NOTES: The game was halted for 10 minutes in the seventh inning while medical personnel treated two fans struck in the face by the same foul ball. One of them was taken to a hospital for treatment. ... Before the game, the Marlins recalled LHP Dan Jennings from Triple-A. ... RHP Henderson Alvarez (5-3, 2.32) is scheduled to start when the Marlins open a series at home Tuesday against Philadelphia.