Updated

Gordon Beckham's bases-loaded walk with two outs pushed Chicago ahead in a four-run ninth inning that lifted the White Sox to their sixth straight win and an improbable 7-5 comeback victory over the Boston Red Sox on Sunday.

The win completed a sweep of the three-game weekend series and came after Chicago trailed 5-3 entering the ninth inning and had two outs.

Victor Martinez had a two-run homer for the Red Sox, who lost both games of a day-night doubleheader by 3-1 scores on Saturday.

Red Sox closer Jonathan Papelbon (5-6) was one out away from the save, but Carlos Quentin's bloop RBI double to center cut the score to 5-4 before Ramon Castro tied it with a single.

Scott Linebrink (3-1) pitched one inning of relief for the win, and Matt Thornton got the final three outs for his sixth save.

Alex Rios walked leading off the ninth against Papelbon, stole second and scored when Quentin's bloop fell in front of diving centerfielder Ryan Kalish. Quentin was alert and went to second when it was left uncovered as the middle infielders had headed to the outfield. Castro's liner to the right-center gap also fell in front of a diving Kalish.

Papelbon walked Alexei Ramirez before Dustin Richardson relieved and walked Mark Teahen. Robert Manuel entered and issued bases-loaded walks to Beckham and Juan Pierre, making 7-5.

Manny Ramirez, who went 3 for 8 on Saturday when the White Sox swept the twinbill, was not in the starting lineup, but was hit by pitch from Papelbon on the right arm pinch hitting in the eighth inning. He left the field for a pinch runner, trotting off to a chorus of mostly boos.

Kalish broke up a possible inning-end double play on Jed Lowrie's grounder with a take-out slide on second baseman Beckham before Martinez put Boston ahead 4-3 with his homer over the Green Monster seats against starter Mark Buehrle.

Bill Hall's run-scoring ground out had made it 5-3 in the eighth.

The White Sox chased Josh Beckett in the seventh and scored two runs with only one infield hit to grab the 3-2 edge. Juan Pierre walked leading off and stole his major league leading 54th base. After Omar Vizquel popped out, Beckett fired widely into center for an error trying to pick off Pierre, who advanced to third. Alex Rios walked and Bard relieved, striking out Paul Konerko, before Rios stole second.

Quentin then hit a hard one-hop grounder off Bard's glove that caromed to the pitcher's right. He recovered in time, but short-hopped a throw to first baseman Mike Lowell that bounced away as both runners came home.

Beckett gave up three runs — one earned — on nine hits, walked two and struck out nine in 6 1-3 innings.

Buehrle gave up four runs, 10 hits, striking out six and walking one in seven innings.

The Red Sox took a 2-1 lead in the third when David Ortiz, just 3 for his last 25, lined a two-run double into the right-center field gap after Darnell McDonald and Jed Lowrie singled.

Alexei Ramirez's RBI single had given Chicago a 1-0 lead in the second.

NOTES: Boston SS Marco Scutaro was out of the lineup and will have an MRI on Tuesday on his right shoulder. ... Red Sox C Jason Varitek, on the DL since July 2 with a fractured right foot, is expected to start a rehab stint with Triple-A Pawtucket on Sunday night. ... A male fan was taken from the stands by stretcher in the fourth inning. No further information was available. ... Rios stole three bases, giving him 32 and tying his career high from 2008 when was with Toronto.