Updated

Tim Lincecum kept staring at the ground as he spoke about his four-game winless streak.

He was better, he thought, but still not good enough.

Lincecum walked five and struck out seven and the San Francisco Giants lost 5-2 to the Oakland Athletics on Friday night.

"I felt better as the game went on but it's hard when you dig yourself a hole like that," said the two-time Cy Young Award winner. "I just wanted to keep getting better. I was letting some guys get away with the walks."

Since shutting out the A's on three hits last month, Lincecum (5-6) has struggled. He's walked 12 and struck out 13 over his past three games.

"I'm trying to fool hitters, mess with their heads, but that doesn't work very well when you're not throwing strikes," he said. "I just have to be better; it's that simple."

Lincecum allowed three runs — two earned — and five hits in six innings. He was starting to feel good about himself and asked to go out for the seventh.

"He got into a good rhythm," Giants' manager Bruce Bochy said. "He wanted to go out there again because he felt good about where he was. But when he walked the leadoff guy I had to go get him. I didn't want him grinding through the inning."

Conor Jackson had three hits and an RBI, and Graham Godfrey pitched seven innings to win in his second major league start for Oakland. Josh Willingham added an RBI double.

The A's ended a six-game losing streak against the Giants and have won three straight under interim manager Bob Melvin.

Cody Ross homered for San Francisco but the Giants couldn't overcome Lincecum's fourth straight shaky outing and a sputtering offense that continues to misfire with runners in scoring position.

The A's hadn't defeated Lincecum in six previous interleague games between the two teams.

Oakland jumped on Lincecum for one run in the first and two more in the third inning. The three runs equaled the total Lincecum gave up to Oakland in his previous five starts combined.

Godfrey (1-0) and two relievers did the rest, combining on the six-hitter.

It was a tough day all around for San Francisco's pitchers and came less than 24 hours after reliever Santiago Casilla gave up a walkoff home run to Arizona's Justin Upton in the 10th inning.

Lincecum didn't make it out of the fifth inning in either of his previous two starts and ran into trouble early again. He gave up a two-out RBI single to Jackson in the first inning, then later loaded the bases before getting Kurt Suzuki to ground out.

After Lincecum breezed through the second on 11 pitches, the A's got to him for two more runs in third.

Hideki Matsui walked and scored on Willingham's double when the ball hit a folded chair leaning against the wall near Oakland's bullpen. Willingham stole third but catcher Chris Stewart's throw sailed into left field, allowing Willingham to score easily and make it 3-1.

The three runs are the most the A's have scored off Lincecum since June 8, 2007 — his second month in the majors.

Ross homered off Godfrey in the second, and San Francisco added an unearned run in the sixth when Aubrey Huff's slow grounder rolled through the legs of shortstop Cliff Pennington.

Godfrey pitched out of a jam in the first then later made an inning-ending play in the fourth to tag out Pablo Sandoval trying to score the tying run from third on a wild pitch.

That was key because San Francisco didn't get many other chances.

Notes: Hall of Famer Rickey Henderson wore an A's uniform during pre-game warmups and talked with several Oakland players. ... Giants LHP Barry Zito allowed four runs in six innings during his latest rehab start. Zito (sprained right foot) is likely to make one more outing in the minors, according to manager Bruce Bochy, before the club decides what to do next. Bochy has already said that Ryan Vogelsong, who was called up when Zito went to the minors, will remain in the rotation when Zito is ready to return to the big league club. ... Oakland 2B Mark Ellis (hamstring) will begin a three-game rehab assignment with Triple-A Sacramento beginning Saturday. ... RHP Tyson Ross (strained left oblique) threw off a mound, an important step in his rehab. ... RHP Brandon McCarthy (stress reaction in right scapula) is scheduled to throw to hitters Saturday for the first time since early May. ... The game was sold out, just Oakland's third of the season.