KANSAS CITY, Mo. -- From the moment Josh Beckett stepped on the mound Thursday night, something didn't feel quite right. It wasn't something mechanical in his delivery, though, nor was it something physical.

Turns out it was the mound itself.

The one in the bullpen at Kauffman Stadium is far steeper than the actual mound on the field, Beckett said, so it took him a while to get comfortable. He finally did and lasted seven innings, leading the Boston Red Sox to a much-needed 4-3 victory over the Kansas City Royals.

"I had to make sure I stayed on the rubber, you know?" Beckett said. "I don't know if I've ever thrown somewhere where they have as drastically different bullpen from the mound."

Beckett (10-5) allowed all three runs over the first three innings, on a two-run homer by Alex Gordon and a sacrifice fly by Billy Butler. But he was efficient and effective after that, allowing seven hits while improving to 7-1 in his career against the Royals. The only loss was July 28 in Boston.

"He left a breaking ball up to Gordon, but I mean they got a good lineup. They got a good offensive lineup. They're aggressive," Red Sox manager Terry Francona said. "He got us through seven with the lead."

Dustin Pedroia drove in three runs with a pair of well-timed singles, and Jason Varitek drove in the other run for the Red Sox, who had lost five of their past seven games after getting shut out by the division-rival Tampa Bay Rays on Wednesday. It was an important win to keep pace with the New York Yankees in the AL East.

Daniel Bard worked the eighth for Boston, and Jonathan Papelbon made it through a perfect ninth to extend his career-best streak to 24 consecutive saves. It was his 29th of the season.

"Their lineup is dangerous," Francona said. "You make a mistake and they can hurt you."

Luke Hochevar (8-10) labored through 114 pitches in just six innings for the Royals. The former No. 1 overall draft pick allowed all four runs on eight hits and two walks, despite getting some help from his defense.

The Royals threw out three Red Sox baserunners: Varitek was nabbed at second trying to stretch a single in the second inning; Crawford was thrown out by center fielder Melky Cabrera trying to score from third base on a shallow fly ball in the fourth; and Pedroia was thrown out at second base by catcher Salvador Perez, who made an alert play after a late throw to the plate on Pedroia's RBI single in the fifth.

"Every pitch he got hurt on was actually a good pitch," Royals manager Ned Yost said of his starting pitcher. "You go back in your mind and look at the game. We competed very, very well. We just got beat.

"It wasn't anything where a pitcher hung a pitch or made a terrible pitch or made a mistake," Yost said. "We had three more outfield assists. It was a really good game that we got beat."

Butler gave the Royals a brief lead with his sacrifice fly in the first, but Boston answered right back on Varitek's two-out single in the second. The Red Sox then pulled ahead in the third when Mike Aviles singled against his former team, Ellsbury walked, both advanced on a groundout and scored on Pedroia's single.

Alcides Escobar led off the bottom half of the third with a single, and Gordon followed by slapping a pitch from Beckett over the left-field wall to tie the game. His 16th homer matched a career high.

"He just crushed that ball to left field," Yost said. "That takes a man-sized boat to get it out, especially from a left-handed hitter, but he got every bit of it."

The Red Sox nearly pulled ahead in the fourth when Crawford reached on a single, swiped second base and then stole third -- replays showed he should have been called out. Aviles lofted a fly ball to center moments later, and Cabrera caught it on a jog and unloaded toward home in one motion. Perez fielded the throw on the fly, turned and braced himself as Crawford barreled into him at the plate, holding on for the out.

It was the 21st time a Royals outfielder has thrown out someone at the plate, leading the major leagues.

Undaunted, the Red Sox pulled ahead in the fifth. Jed Lowrie doubled with one out and came around to score on a two-out single by Pedroia, who added a double in the eighth inning for a three-hit game.

"He was a nemesis. He hit the ball where it's pitched," Hochevar said. "The base hit up the middle that scored two runs I was trying to come in off the plate for a ball and I felt like it was off the plate. He put a good swing on it. He had a good piece of hitting."

Game notes

The Red Sox placed 3B Kevin Youkilis on the DL with a sore back. C Ryan Lavarnway, called up from Triple-A Pawtucket, made his major league debut as DH and went 0-for-4. ... Boston designated LHP Randy Williams for assignment to clear roster space for Lavarnway. ... Butler finished 3-for-3. ... Jeff Francis (4-13) takes the mound for Kansas City on Friday night. He goes against Boston's Andrew Miller (4-1).