NEW YORK -- Andy Pettitte gave up two leadoff singles, Shawn Kelley gave up an RBI single and a three-run home run, Boone Logan allowed a single and a walk, and Joba Chamberlain gave up a three-run home run.
The Yankees had a three-run lead when they entered the seventh inning. By the time the Orioles finally made their second out of the frame, the Yankees trailed by four.
Baltimore scored seven runs in the seventh after scoring just five runs over the first 24 innings of the series. Those seven runs were tied for the most the Yankees have allowed in any inning since 2012, and it cost them a three-game sweep as the Orioles left town with a 7-3 win at Yankee Stadium on Sunday.
Pettitte cruised through six scoreless innings to start the game before running into trouble in the seventh, giving up back-to-back singles to lead off the inning before getting pulled for Kelley despite having thrown just 93 pitches.
"He was up in pitches and they had just squared up two balls against him, so we felt it was time to make a change," manager Joe Girardi said. "Unfortunately it didn't work out."
Kelley threw just four pitches in relief of Pettitte, giving up an RBI single to catcher Matt Wieters and a three-run home run to shortstop J.J. Hardy as the Orioles quickly turned a 3-0 deficit into a 4-3 lead.
"It's completely on me for those pitches right there. I've got to get Wieters and Hardy out and get us into the dugout with a lead," Kelley said. "Three-run lead, going into the seventh, chance for a sweep against a team we're right there, neck and neck with -- it's a tough one to swallow."
Hardy's home run narrowly left the yard, bouncing off the top of the wall before trickling into the seats. Right fielder Curtis Granderson said he got to the ball and thinks he got his glove on it -- "I'm not 100 percent sure," he said -- but he wasn't able to come down with it.
"That was definitely a Yankee Stadium home run today," catcher Chris Stewart said. "A foot further in the field and we're talking sac fly, runner on first. The next guy could hit a ground-ball double play and we're still winning. But unfortunately it was just far enough and they took the lead on it."
Logan gave up a bunt single to Brian Roberts and walked Nick Markakis before getting pulled in favor of Chamberlain. After Manny Machado made the first out of the inning on a foul pop to the catcher, Adam Jones drilled a three-run home run into Monument Park to put the Orioles on top, 7-3.
"A seven-run seventh, that's nice," Hardy said. "We were a little flat. We could all see it. We could all feel it. That was big for us. Hopefully that jump-starts our September."
Pettitte threw six-plus innings in the game, allowing two runs on seven hits. Kelley and Logan gave up two runs each without recording an out, and Chamberlain gave up one run on one hit over two innings pitched.
"When someone does good, everyone does good," Logan said about the team's bullpen. "When someone [struggles], we all [struggle]. It's just one of those days where everybody had a bad game."
Pettitte said he didn't have a problem with Girardi taking him out of the game after just 93 pitches, even though Wieters was 2-for-10 in his career against the left-hander and 0-for-2 with two strikeouts before the seventh inning.
"It's not even an issue to me. I know Joe has all the faith in the world in our bullpen, and I know Joe has faith in me, also," Pettitte said. "Right now, you can't second guess going to our bullpen. They've just been so great. … Nobody in here -- not me and I'm sure not our manager -- is going to lose any faith in those guys out there."
Entering the game, the Yankees' bullpen ranked first in the Major Leagues with a 1.05 ERA since Aug. 16. But on Sunday, New York relievers gave up as many runs (five) as they had in their last 42 2/3 innings combined.
"They're not going to be perfect, but it is surprising," Girardi said. "They've done a really good job for us, they've been put in tough situations a lot. Today, they just didn't come through."
Left fielder Alfonso Soriano plated the Yankees' first run, in the third inning, hitting an RBI single to center field. The Yankees added two more in the fourth on center fielder Brett Gardner's bases-loaded walk and designated hitter Derek Jeter's sac fly to right.
Those fourth-inning runs chased Orioles starter Wei-Yin Chen from the game. The left-hander lasted just four innings on Sunday, giving up three runs on four hits and five walks.
The loss dropped the Yankees a half-game behind the O's in both the American League East and Wild Card standings, with New York sitting in fourth in both races.
"You talk about winning series, but when you win the first two and you're up 3-0, you get greedy," Girardi said. "And that's the hard part."
Josh Vitale is an associate reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.