Jair Jurrjens' right knee felt fine.

His pitches were the problem.

The Braves' All-Star pitcher surrendered five runs in six innings in his return from the disabled list, and another Atlanta rally came up short in the ninth as the Braves lost to the San Francisco Giants 7-5 Wednesday night.

"I felt good," Jurrjens insisted. "I just left some pitches up. I was a little rusty."

Matt Cain snapped his three-game losing streak with five-hit ball over eight innings. The Giants broke it open with four runs in the fourth, one of them driven in by Cain (10-9) on a sacrifice fly. But he did his best work on the mound, striking out nine and giving up only an unearned run in the first on Chipper Jones' bases-loaded walk.

After Cain left, the Braves scored four runs in the ninth and had the tying run at the plate. But Brian McCann struck out swinging against Jeremy Affeldt.

"You don't want to go down without a fight," Braves first baseman Freddie Freeman said. "At least we gave them a little scare at the end."

San Francisco jumped on Jurrjens (12-5), who was activated before the game and made his first start since Aug. 1. He surrendered eight hits, struck out only one — and at least three balls were caught on the warning track.

The Braves won the first two games of the series, rallying for three runs in the ninth for a 5-4 victory Monday, then pulling out a 2-1 win in 11 innings on Tuesday. They nearly did it again. Martin Prado doubled in two runs after Giants shortstop Orlando Cabrera dropped Michael Bourn's soft blooper behind the mound to extend the inning.

But Affeldt got McCann on a 3-2 pitch.

"This team needed a break," Giants manager Bruce Bochy said. "I know we made mistakes, but a win's a win."

Once the Giants pushed their margin above three runs, Atlanta was in big trouble. San Francisco improved to 32-0 when leading by at least three runs, the majors' only undefeated team in those situations.

The win came at a good time for the struggling Giants, who've been plagued by injuries and were knocked out of first in the NL West with a stretch of only five wins in 18 games. They closed to 2½ games behind Arizona in the division race and with five games of wild card-leading Atlanta.

The Giants broke open a 1-all game in the fourth. Aubrey Huff led off with a double, Nate Schierholtz singled and Cabrera brought home the go-ahead run with the third hit in a row. Brandon Belt walked to load the bases, and Eli Whiteside pushed the lead to 3-1 with another run-scoring single.

Back-to-back drives to the warning track made it 5-1. Cain hit a sacrifice fly to deep center, and Cody Ross followed with a liner that was caught in front of the left-field wall, allowing Belt to trot home.

Jurrjens wasn't exactly fooling the Giants even when his teammates caught the ball. Schierholtz hit one to the track in right that was hauled in by Jose Constanza.

"Right now, I just need to go to the bullpen and get my pitches back," Jurrjens said. "I've got to get a feel for them again."

San Francisco closer Brian Wilson wasn't available to pitch after flying to Florida to have his ailing right elbow checked out. It's nothing serious, but Bochy decided to give Wilson a second night off to rest his arm.

The way Cain pitched, it looked like the Giants would be just fine without Wilson.

Then came the ninth.

"I think we won," Bochy quipped. "Just when you think you have a chance to cross your legs for a second, we're facing the tying run up there."

San Francisco jumped ahead in the first on back-to-back doubles by Mike Fontenot and Pablo Sandoval. The Braves tied it up in the bottom half, taking advantage of a miscue by Sandoval at third base.

With two runners on and one out, Sandoval fielded Dan Uggla's grounder and attempted to tag Bourn running toward third. But Bourn dodged the glove, and Sandoval's throw to first was too late to get Uggla, either.

Cain struck out Freeman with the bases loaded, but Jones walked to bring home the tying run.

Jurrjens went on the disabled list with a strained right knee. He hasn't been the same dominating pitcher he was before making the All-Star team, giving up at least four runs for the fourth time in his last five starts. That happened only once in his first 16 appearances.

The Giants made it 7-1 in the ninth with two more sacrifice flies off Scott Linebrink. Sandoval picked up his second RBI and Huff brought home the other run.

NOTES: Braves RHP Peter Moylan is scheduled for another bullpen session Thursday as he continues his recovery from back surgery. ... Whiteside left the game in the seventh because of dizziness. He smashed his face into the dirt when thrown out attempting a steal to end the fourth. ... The Giants tied a San Francisco record with four sacrifice flies, last done in 1988.