Updated

Jeff Niemann had no problem with being pulled one out away from a complete game.

Niemann took a four-hitter into the ninth inning en route to winning his fifth consecutive decision and the Tampa Bay Rays beat the Oakland Athletics 8-4 on Friday night.

Niemann (6-4) allowed four runs and seven hits over 8 2-3 innings, and had the night end when his pitch count reached 119 and manager Joe Maddon went to the bullpen. The right-hander was replaced by Kyle Farnsworth after giving up a pair of runs and three hits in the ninth.

"It's tough, you know," Niemann said. "Joe gave me every chance possible, I think, to finish that game. It just wasn't in the cards."

Niemann improved to 5-0 in eight starts since returning from a strained lower back on June 20.

Evan Longoria and Casey Kotchman both had run-scoring doubles, and Matt Joyce hit an RBI single in the fifth that put the Rays up 4-0. After losing nine of 12, Tampa Bay has now won six of eight.

"I think our players are really starting to believe again, strongly," Maddon said. "It's kind of a nice vibe."

Coco Crisp and Hideki Matsui homered for the Athletics, who have lost 30 of their last 37 games away from home. Oakland entered hitting an AL-low .232 on the road.

"We gave ourselves some holes on the road that we have to comeback from and it's not a great recipe for success," Oakland manager Bob Melvin said.

Athletics shortstop Cliff Pennington was back in the starting lineup after missing two games because of Bell's palsy and tripled in four at-bats. He left Monday's game against Seattle because of the condition that can cause partial facial paralysis.

Niemann has won all three of his career starts against Oakland. He was looking for his first complete game since a two-hitter against Toronto on June 8, 2010.

"He was really good," Maddon said.

Niemann struck out eight and walked one.

Crisp cut the Oakland deficit to 4-2 with a two-run homer in the sixth. Tampa Bay responded with three runs in the bottom half of the inning when Ben Zobrist drove in a pair on a single and B.J. Upton added a run-scoring single.

Upton also had an eighth-innng RBI triple.

Matsui hit a solo shot and Pennington had an RBI triple in the ninth.

The Rays took a 1-0 lead on a bases-loaded RBI grounder by Robinson Chirinos — that deflected off Guillermo Moscoso — with one out in the fourth. The Rays' rookie catcher has driven in seven runs over his last three games after having none in his first 11 big league games.

Moscoso (4-6) gave up four runs and six hits in 4 2-3 innings.

"I thought his stuff was pretty good and he looked like he hit a wall," Melvin said.

Oakland right fielder David DeJesus, slowed by right thumb soreness, returned after missing the previous three games. He struck out with a runner on second with two outs in the fourth, and wound up 1 for 4.

NOTES: The Rays have scored at least seven runs in three straight games for the first time this season. ... Matsui extended his hitting streak to 13 games with a fourth-inning single. ... Tampa Bay C John Jaso (strained right oblique) has resumed batting practice. ... Oakland RHP Brandon McCarthy (4-5), Saturday's scheduled starter, is 3-0 with a 3.70 ERA in four outings since the All-Star break. ... Rays rookie RHP Alex Cobb (3-1) will face Oakland for the first time Saturday. ... Texas senior adviser Tom Giordano, who played for the 1953 Philadelphia Athletics, was at the game.