NEW YORK -- For the second night in a row, the Boston Red Sox blew an eighth-inning lead against the rival New York Yankees, only to win the game on a hit by Pedro Ciriaco in their final at-bat.

On Sunday, it was a soft single to right with one out in the 10th inning, giving the Red Sox a 3-2 victory in the Yankees' first extra-inning home game this season.

The hit capped a wild 10th that led to two Red Sox ejections, including that of manager Bobby Valentine, who punctuated his tirade by flinging his chewing gum as he exited. A few moments later, Red Sox starting pitcher Josh Beckett, who did not appear in the game, was ejected for jawing with third base umpire Tom Hallion.

Boston's second straight win over its rival in dramatic fashion gave the Sox a rare sign of life during a disappointing season while reducing the Yankees' lead over the Baltimore Orioles in the AL East to 7 1/2 games. The Orioles come into Yankee Stadium on Monday for the start of a three-game series.

"I don't know that it does anything for tomorrow," Valentine said of the two consecutive wins that pushed Boston to .500. "But I like the way we played."

The 10th-inning ejections came after a call that ultimately led to a Boston hit.

After walking Jarrod Saltalamacchia to start the top of the 10th, Yankees reliever David Robertson (1-4) unleashed a pitch that plate umpire Brian O'Nora said hit Will Middlebrooks' bat as the Boston third baseman squared to bunt.

Valentine contended the pitch -- which led Middlebrooks to fall down, then nipped O'Nora, who also tumbled -- hit Middlebrooks' hand on the bat.

The Red Sox manager initially appeared to discuss the play calmly before growing more animated during the argument. He said after the game he was mostly upset because O'Nora told him he didn't see the ball hit the bat, but heard it.

"What are you gonna do?" Valentine said. "I'm not gonna say anything that gets me fined any more."

Despite the heated debate, Middlebrooks took advantage of the foul-ball call, as he hit a single. One out later, Ciriaco knocked in Saltalamacchia, one day after tripling in the winning runs.

"No matter the situation, I feel confident, and I just try to do my job," Ciriaco said. "It feels pretty good. Everything is good right now."

Robertson was most upset with himself for starting the inning with a walk.

"That's what haunts me in that inning is the leadoff walk, and leadoff walks always come back to haunt you," he said, adding he didn't consider the arguments and ejections much of a distraction. "There is not a whole lot you can do about it except try to remain calm and focused and get ready to pitch."

Alfredo Aceves (2-6) blew the lead in the eighth but picked up the victory after allowing one run in the final 2 1/3 innings. Aceves pitched a scoreless 10th despite hitting Nick Swisher with a pitch with two outs. He battled pinch hitter Raul Ibanez during a long, tense at-bat, before finally striking him out to end the game.

The late Yankees rally left the game in the hands of the bullpens after starters Felix Doubront and Hiroki Kuroda had battled for most of the game.

Yankees closer Rafael Soriano started the ninth of the 2-2 game and hit Carl Crawford with a pitch, but he came back to get the next three batters.

The Yankees tied the score with consecutive two-out hits in the eighth against the Boston bullpen.

Andruw Jones doubled to left off Andrew Miller, and Valentine went to Aceves in an attempt for a four-out save, despite Aceves' poor numbers against the next batter, Russell Martin. The Yankees catcher had been 3-for-5 with a homer and RBI against him, and he added a RBI single up the middle to tie the game, 2-2.

Martin had also homered in the seventh to get the Yankees on the board and cut the deficit to 2-1.

"I feel good right now," Martin said.