Updated

Josh Beckett usually reserves these kinds of Fenway performances for the New York Yankees.

Beckett gave up a season-high eight runs over five-plus innings and the Boston Red Sox couldn't outslug Texas, losing to the Rangers 10-9 Wednesday.

"It's tough. It'd be a lot better if we were winning two out of every three games. That's what makes it tough," said Beckett, who matched his Fenway Park high with the eight runs. "These are the guys that I got to come to work with every day. It's been tough on all of us."

It was the seventh time he's given up eight or more runs at Fenway — including four times against the rival Yankees — and first since May 7, 2010.

The Rangers chased him when Geovany Soto hit a two-run homer in the sixth, making the score 8-5. Beckett was loudly booed as he walked slowly to the dugout after being pulled.

"He made some good pitches and I guess some not-so-good pitches," Boston manager Bobby Valentine said. "He finished the fifth inning pretty good and it's the bottom of the order, I thought he could maybe squeak one out. I sure wasn't expecting Soto to hit a home run."

The one-time ace of the staff had his ERA climb to 4.97 from 4.54 in his first start since leaving July 31 with back spasms.

Adrian Beltre's tiebreaking sacrifice fly in the ninth inning lifted the Rangers after they blew a late four-run lead.

Beckett felt like he let the offense down.

"They kept fighting back and that's kind of what we've done all year," he said. "They deserve a lot of credit — not just today — but through the course of the year. They just kept battling back and they played great defense behind me as well."

Beckett's career-best streak of starts without surrendering a home run was halted at 12. It was the longest in the majors' this season and most by a Red Sox starter since Mel Parnell's 14 straight in 1948.

Josh Hamilton homered among his three hits and had four RBIs for Texas, which couldn't hold a 9-5 edge before pulling out its sixth win in eight games.

Mitch Moreland and Nelson Cruz also homered for the Rangers. It was Soto's first with Texas since being acquired from the Chicago Cubs in a non-waiver deadline deal last week.

The AL West-leading Rangers took two of three from Boston, closing their road trip at 4-2.

Will Middlebrooks had a three-run homer for the second straight game, and Cody Ross added a solo shot and drove in two runs for Boston, which has lost six of eight and went 4-6 on its longest homestand of the season.

Adrian Gonzalez added three RBI doubles for the Red Sox.

It was only Hamilton's fourth multi-hit game in his last 27. Before Wednesday, he had just two homers and 16 RBIs since the All-Star break.

Alexi Ogando (2-0) worked two perfect innings of relief for the win. Joe Nathan pitched the ninth for his 23rd save, striking out the last two batters with a runner on second.

With the score tied 9-all, Elvis Andrus walked and moved to third on Hamilton's single off Clayton Mortensen (1-1). Alfredo Aceves relieved before Beltre's sacrifice fly.

Trailing 9-5 in the seventh, Boston tied it when Gonzalez had his third run-scoring double and Middlebrooks homered into the left-field seats off reliever Roy Oswalt.

Cruz's homer off Mortensen made it 9-5 in the seventh.

With the score tied 3-3 in the fifth, Moreland led off with a homer off a TV stanchion in straightaway center. Andrus singled before Hamilton hit a shot deep into the right-field seats for his 30th home run, making it 6-3 and giving the slugger his third season of 30 or more homers.

Gonzalez's second RBI double had cut the score to 6-4 in the fifth. Texas starter Matt Harrison then loaded the bases with consecutive two-out walks before he was lifted for Oswalt. Gonzalez scored on catcher Soto's passed ball, slicing it to 6-5, but Kelly Shoppach struck out to end the threat.

Harrison was charged with five runs — four earned — on eight hits in 4 2-3 innings.

The Rangers' continued Beckett's season-long first-inning misery, jumping ahead 3-0. Hamilton had a two-run triple into the center-field triangle and scored on Beltre's sacrifice fly. Beckett's ERA rose to 10.42 in the first innings of his starts.

In the first, Gonzalez's RBI double and Ross' run-scoring single made it 3-2.

Ross' homered in the third — his first in 18 games — just inside the left-field foul pole, tying it at 3.

NOTES: It was just Hamilton's second homer in his last 19 games. ... Red Sox DH David Ortiz, on the 15-day DL since July 18 with a strained right Achilles, did some agility drills and looked good running the bases about two hours before the game. On Tuesday, he took batting practice on the field and said he hopes to return when the club plays in Cleveland this weekend. ... Boston placed RHP Vicente Padilla on the 15-day DL before the game with right arm tightness and recalled RHP Mortensen from Triple-A Pawtucket. ... The Rangers put C Yorvit Torrealba on waivers. If he's not claimed by Friday he'll become a free agent. He was designated for assignment when the club acquired Soto from the Cubs on July 31.