The Boston Red Sox had just rallied from a four-run deficit, and just as quickly they gave the lead back to the Baltimore Orioles.

And so, after a 5-4 loss Wednesday night, the Red Sox could derive absolutely no satisfaction from their unlikely comeback.

Boston was 0-11 when trailing after seven innings, but after scoring four runs in the eighth — the last three on a home run by Kevin Youkilis — it seemed momentum was on their side.

But the Orioles went back on top in the bottom half, leaving the Red Sox to lament about a second straight defeat following a five-game winning streak.

"It was kind of a roller coaster that turned in a hurry for us," Boston manager Terry Francona said. "We were scrambling, not doing much offensively, then (Youkilis) gets the home run. Then we give up a run. It's a tough loss. It hurts."

Boston made a game of it in the eighth. After Jacoby Ellsbury singled and Dustin Pedroia walked against Jeremy Accardo, Adrian Gonzalez hit an RBI single off Clay Rapada. Koji Uehara (1-0) entered, and Youkilis hit a 2-1 pitch into the left-field seats to tie it.

But Baltimore came right back against Daniel Bard (0-3). Nick Markakis singled and took second on a base hit by Derrek Lee, and both moved up on a passed ball by Jason Varitek. With Vladimir Guerrero at the plate, Markakis was thrown out trying to score on a pitch that eluded Varitek.

Guerrero then bounced an RBI single up the middle to bring in Lee from third base.

"On the tag, I tried to get the ball down as quick as I could and get my foot in position," Bard said. "After that, I'm thinking strikeout and find a way to get the next guy out. Then I made a terrible pitch to Guerrero. I tried to get a four-seamer in there and left the ball out there and belt high."

Kevin Gregg worked a perfect ninth for his fourth save.

By winning the first two games of the three-game set, the Orioles captured their first series since taking two of three against Detroit on April 4-7. Baltimore has won 11 of 18 against the Red Sox after going 3-25 from July 12, 2008 through April 24, 2010.

Orioles starter Jeremy Guthrie gave up seven hits, walked one and struck out six in six shutout innings. He left with a 4-0 lead, but the Baltimore bullpen ruined his bid to end a seven-game losing streak against Boston.

Guthrie outpitched Josh Beckett, who allowed four runs and seven hits in six innings. The right-hander permitted only three earned runs in his previous three starts and surrendered only one homer in 31 innings this season before Luke Scott and Adam Jones connected in succession in the fourth.

Both starters were in control until Lee hit a popup to right field with one out in the fourth. As a result of an apparent miscommunication, the ball landed between second baseman Pedroia and Ellsbury, the center fielder.

"Obviously, that's a huge play any time you give them an extra out," Francona said. "It's not an error, but we didn't catch the ball."

One out later, Scott hit a 1-0 pitch onto Eutaw Street beyond the 25-foot scoreboard in right. Jones followed with his fifth home run, a drive to left that was touched by a fan in the front row of the stands before Carl Crawford could try to catch it.

A sacrifice fly by Brian Roberts made it 4-0 in the fifth.

Crawford bounced into a rare double play to end the second inning for Boston. It was the first time in 87 at-bats this year that he hit into a DP; last season he hit into two double plays in 600 official at-bats with Tampa Bay.

In the fourth, David Ortiz tried to score from second on a two-out single to right by Jed Lowrie. Markakis unleashed a throw that hit catcher Matt Wieters on the fly, and Ortiz was tagged out at the end of an awkward slide.

NOTES: Jon Lester, who's 13-0 lifetime against Baltimore, will pitch for Boston on Thursday in the series finale. ... In the 20-year history of Camden Yards, Scott has hit five of the 53 home runs that have landed on Eutaw Street. This one traveled an estimated 426 feet. ... Boston has gone seven straight games without an error. ... Roberts' 12-game hitting streak ended.