James Loney drove in two runs, including the winning run on a one-out bloop single to center in the eighth inning, as the Tampa Bay Rays avoided a three-game sweep with a 4-3 victory over the Boston...

Red Sox catch Rays in ninth

ST. PETERSBURG, Fla. — Will Middlebrooks’ two-out, bases-clearing double off closer Fernando Rodney in the ninth inning lifted the Boston Red Sox to a stunning 4-3 win over the Tampa Bay Rays on Thursday night at Tropicana Field.

Middlebrooks was down to his last strike after taking a 100 mph fastball over the plate but hit a changeup to the wall in left to score three batters who had reached on walks by Rodney. The blown save was Rodney’s third after failing to convert on just two of 50 last season.

Boston won the series and improved to 24-18. Tampa Bay fell to 20-20.

Rodney walked Dustin Pedroia and David Ortiz to start his own trouble before striking out Mike Napoli. Another walk to Daniel Nava loaded the bases, but Rodney appeared close to escaping with a strikeout of Stephen Drew and then jumping ahead of Middlebrooks with a 1-2 count. The bases cleared quickly when left fielder Matt Joyce was unable to stop Middlebrooks’ fast-rolling grounder before it reached the wall.

Junichi Tazawa (3-2) pitched two innings to pick up the win but had to retire American League batting leader James Loney, hitting .370 at the time, with two outs and the tying run at second.

Walks were at the center of both teams’ troubles. Boston’s inability to throw strikes set the Rays up for a go-ahead two-run rally and a 3-1 lead in the sixth in which Desmond Jennings and Luke Scott had RBI singles.

Dr. James Andrews performed Tommy John surgery on the ulnar collateral ligament in Hanrahan’s elbow and also repaired the flexor tendon in his right forearm, agent Mike Dillon said.

Also, reliever Andrew Bailey will make a rehab appearance Saturday for Triple-A Pawtucket, and if all goes well, he’d be activated Monday for the Red Sox’s series opener in Chicago against the White Sox.

Bailey has been out since April 29 due to right biceps inflammation. He figures to take over the closer role upon his return.