CHICAGO -- At a time the Red Sox are desperate for wins, they simply can't afford to be on the wrong side of history.

So, as John Danks carried a perfect game into the sixth inning, and then simply a no-hitter into the seventh, the Red Sox kept their resolve and spoiled what would have been a career night for the talented left-hander.

Not only that, but they found a way to win the game too, 5-1, over the White Sox, to salvage a split of the four-game series and finish the road trip with a 4-3 mark.

"We had great energy," said Red Sox manager Terry Francona. "We had nothing to show for it early. But everybody stayed at it. It was a great atmosphere. Tonight was a fun game to play. It's better when you have the lead. But it was well played. We stayed at it and got a win."

The big hit of the night came from J.D. Drew, who lofted a two-run double into the gap in left-center with two outs in the seventh. That turned a 1-0 deficit into a 2-1 lead. For Drew, it was a key contribution on a night he served as the designated hitter, giving David Ortiz the night off to rest his recovering left wrist.

"[I was] just trying to get a pitch I could handle out over the plate," said Drew. "He got one up. He threw me a really good pitch the first pitch of the at-bat. [I] just tried to stay on it and drive the ball and got it in the gap."

With one out in that seventh, Kevin Youkilis stymied the no-hit bid of Danks by hitting a soft liner into center for a broken-bat single.

"Yeah, the thing was shattered," said Youkilis. "I just took a swing, it got in on me a little bit, and luckily, I got it over the shortstop's head and into center field. As a hitter, you're going up there every time trying to get a hit. Just looking for a walk, a hit, whatever you have to do to win a ballgame."

Mike Lowell followed with a walk. And after Jason Bay struck out, Drew stung an 0-1 fastball for what stood up as the game-winning hit.

"This game is hard to figure out sometimes," said Francona. "The good part of it was, it was a 1-0 game. You always feel like you're a hit or a walk [away]. Or like what happened tonight, J.D. hits a ball in the gap and all of a sudden we're winning."

For that, they could thank ace Josh Beckett. Although he was overshadowed by Danks for much of the night, Beckett turned in his second big effort of the road trip. The right-hander went eight innings, allowing seven hits and one run, improving his record to 11-8 and lowering his ERA to 3.92. Beckett didn't walk anyone, striking out eight.

"Any time you hold a team to one run, when you have a lineup like we have, I think you feel pretty good about your chances," Beckett said. "I was pretty focused from pitch to pitch tonight. The result ended up being pretty good. The guys picked me up, scored a couple of runs in that inning, and we ended up tacking three more on."

Jed Lowrie's bases-loaded double off reliever Matt Thornton in the ninth added two insurance runs. Ellsbury singled in the final run.

Speaking of Ellsbury, he was hit on the tailbone with two outs in the sixth, ending Danks' bid for a perfect game.

"It didn't feel too good," said Ellsbury.

However, the center fielder and his team were more than happy with the way the night turned out.

The Rays were idle, allowing the Red Sox to gain a half-game and shrink the deficit in the American League East to four games. Boston now holds a two-game lead over the White Sox in the Wild Card standings.

"Any time you get on a plane and you win, it's a lot better," said Ellsbury. "It will be nice to go back home."

Having snapped John Lackey's no-hitter with one out in the ninth back on July 29, the Red Sox took care of business a little earlier this time.

"The way Danks was throwing, you don't want them to spread out or get an extra run because his stuff was so good," said Francona. "Everything was working. He's throwing changeups, he's throwing fastballs, cutters, curveballs. But Beckett kept him at one and gave us a chance."

At a time in the season where the Red Sox need him most, Beckett is starting to look locked in.

"He was clean today with his delivery," said Red Sox catcher Jason Varitek. "Balls were going where he wanted them to. He's had to fight that quite a bit throughout different points of the year. But no better point than now to figure it out."

When Beckett is in top form, he has a habit of taking his team along for the ride.

"I think he's got a lot left in the tank for whatever we have left," Francona said. "He looks strong. He's locating. And we will need him to do that. He looks like he is primed to go ahead and be the guy we need. We needed every bit of what he did tonight."