BOSTON — Kevin Youkilis didn’t mind taking some fun-filled jabs from his teammates. It was much better than the alternative.

Youkilis hit an RBI double off the base of the left-center field wall with two outs in the 12th inning Wednesday night, and the Boston Red Sox beat Texas 8-7, sending the Rangers to their sixth straight loss.

It was Boston’s second straight last at-bat win after losing its previous five games.

When Youkilis reached second, he knew what was coming as his teammates poured onto the field.

“I’d rather get beat up than beat myself up in the dugout,” said Youkilis, known for firing his helmet at times after tough outs. “I’ve been in a little bit of a rut lately.”

Youkilis, the cleanup hitter, entered the night hitting just .240 with only six RBI.

Neither team did much in the extra innings until Marco Scutaro singled with one out in the 12th and alertly tagged up on a medium deep flyout to center, sliding in barely under second baseman Joaquin Arias’ tag. After Dustin Pedroia was intentionally walked, Youkilis delivered against Dustin Nippert (0-2).

Pedroia was dropped from second to the third hole one night earlier.

“That’s the idea of having good hitters hit back to back,” Boston Manager Terry Francona said.

Rangers Manager Ron Washington wanted to avoid facing Pedroia.

“We felt like we could do better with the hard stuff with Youkilis and soften him up. He ended up hooking a breaking ball,” Washington said. “I’ve seen (Pedroia) hit too much stuff on The Monster late (in games).”

J.D. Drew hit a grand slam and Darnell McDonald homered in his second straight game for Boston. Mike Lowell also connected.

Josh Hamilton hit a three-run homer in the Texas seventh that made it 7-7.

Texas was successful on all three steal attempts after swiping a team-record nine Tuesday night. The Rangers are 30 of 30 over the past two seasons against the Red Sox. Boston’s catchers have thrown out just 1 of 34 runners overall who have tried to steal this year.

Hideki Okajima (2-1) pitched one hitless inning for the win.

Down 7-4 in the seventh against Boston ace Josh Beckett, Hamilton homered deep into the center-field bleachers.

Beckett struggled with his control and was tagged for seven runs on six hits in seven innings. He walked five and stuck out four.

“At least we won the game,” he said. “It makes me feel a lot better.”

Texas led 4-0 after two innings.

“I thought we actually played well tonight,” Michael Young of the Rangers said. “Up until we got the ‘L’ it was a fun game to be a part of.”

Boston moved ahead 5-4 in the third when Drew lofted a fly ball down the right-field line that hooked around the foul pole into the second row of seats for his fifth career slam.

McDonald homered into a camera area in center, making it 6-4 in the fourth.

Lowell, starting at DH, homered into the left-field seats.

NOTES: Francona had a meeting with struggling David Ortiz a few hours before the game after deciding to pinch hit for him Tuesday and using Lowell as the DH on Wednesday. “He’s been an unbelievable player here,” Francona said. “I just wanted to let him know that we care about all our players and that we try to do what’s right for our team.”