"We got behind and were able to come back a couple times," Girardi said. "We had a huge inning, some big home runs, some big base hits by some guys. It was a nice job."
Sabathia was perfect through the first 3 1/3 innings before allowing his first hit -- a ground-rule double to third baseman Manny Machado -- in the fourth. Machado came around to score on first baseman Chris Davis' RBI single, giving the Orioles an early 1-0 lead.
Gonzalez matched Sabathia with three no-hit innings to start the game, but he also gave up his first hit -- and runs -- of the game in the fourth. Left fielder Alfonso Soriano hit his 12th home run in 32 games as a Yankee after second baseman Robinson Cano worked a two-out walk, putting New York ahead by a run.
Soriano is now batting .295 with 11 home runs and 31 RBIs in his last 22 games.
"He's playing like an MVP. When you look at the month of August and what he's done in the month of August, these are MVP-type numbers if you put them over six months," Girardi said. "Stealing bases, playing really good defense; he's been a complete player for us."
The Yankees' lead didn't last long, though, as Sabathia gave it right back in the fifth inning. Designated hitter Danny Valencia hit a two-run home run of his own after Nick Markakis' leadoff single, and Baltimore picked up one more run on Machado's two-out RBI single to take a 4-2 lead.
But Gonzalez unraveled in the bottom of the frame, giving up a single, a walk, a home run -- Ichiro Suzuki's seventh of the season -- three doubles and three runs on 18 pitches before being removed from the game without recording an out in the inning. Reliever T.J. McFarland allowed two inherited runners to score on Cano's two-run single, giving the Yankees a three-run cushion.
"He pretty much no-hit us until then," said first baseman Mark Reynolds, who went 3-for-4 with two doubles and an RBI. "I think guys started seeing that, got the ball rolling a little bit, got some confidence and we were able to chase him out of there."
Playing in his first game since suffering a bruised left hand against the Blue Jays on Tuesday, Cano went 2-for-3 with a walk, two RBIs and two runs scored.
Gonzalez lasted only four-plus innings on Friday, getting tagged for seven runs on six hits and three walks.
"I think as starters, we just need to go a little bit deeper, and I'm talking about myself," Gonzalez said. "The past couple games have been a little tough on me. Just got to minimize when there's big innings, just minimize when you need to."
Sabathia didn't fare much better, though. Baltimore plated another run off him in the sixth inning before he was removed the game, ending his night after 5 2/3 innings pitched. The left-hander gave up five runs on seven hits, earning the victory despite raising his August ERA to 5.94.
Sabathia was only at 86 pitches after Markakis' RBI single, but Girardi removed him from the game in favor of reliever Shawn Kelley.
"I understand. The way I've been pitching, I don't deserve a longer leash right now," Sabathia said. "I have to prove myself. That's something I've done over the past, and that's something I'll have to do to gain his trust again."
The Yankees added their eighth and final run in the seventh inning on an RBI single from third baseman Alex Rodriguez.
"We never lost the confidence. Now we have a very good lineup and a very good offense," Soriano said. "I hope we continue hitting like we hit tonight and see what happens."