BOSTON -- Josh Beckett found a way to beat the New York Yankees this season, over and over again.

The Red Sox right-hander pitched well enough for Boston to win 9-5 on Wednesday night, improving to 4-0 against the Yankees this season with a 1.85 ERA. Last season, his worst in the majors, he was 1-2 with a 10.04 ERA against his team's longtime rivals.

"The Yankee-Red Sox thing has been here before I got here for a long time and it'll be here long after I'm here," Beckett said. "The big thing is we're both really good teams and there's a reason why you've got to play those games a little differently."

Boston is 5-0 in his starts against New York, but he credited his slugging teammates for Wednesday's win. Jacoby Ellsbury hit a tie-breaking two-run homer in the sixth, making it 7-5. David Ortiz and Jason Varitek also had two-run shots.

"I might get the win next to my name," said Beckett (12-5). "I'd say I contributed by eating up some innings, but the guys that probably stuck out all year, they stuck out again today."

He said the difference from last year, when he was 6-6 with a 5.78 ERA, is his ability to execute pitches in key situations.

The Red Sox, who lost the series opener 5-2 on Tuesday night, extended their AL East lead over the Yankees to 1½ games and improved their record to 11-3 this season against them.

"We can't think about what happened up until this point," Derek Jeter said. "If we did, we might as well let them have the rest of the games."

The Yankees had one big inning against Beckett, scoring four runs in the sixth -- the same amount they managed in his previous 32 innings against them this season -- and went ahead 5-4.