Updated

Jesus Guzman hit a two-run and three-run home run as the San Diego Padres avoided a three-game sweep with a 6-3 win over the San Francisco Giants.

Chase Headley hit a solo home run and Will Venable added a two-run double for the Padres, who had dropped three of four coming into Wednesday's action. Jason Marquis (4-5) won his third straight start as he gave up three runs -- one earned -- on three hits with a walk and eight strikeouts over 7 1/3 innings.

"He's got to pitch good to stay in the rotation, but he's pitched fine," Padres manager Bud Black said. "When he's pitched well, he's been given an opportunity to be given in a major league rotation after Minnesota. He's taken full advantage of it by pitching well."

Marquis pitched in seven games for the Twins earlier this year before being granted free agency after he was designated for assignment. The Padres picked him up a day later, on May 29.

Ryan Theriot and Melky Cabrera each drove in a run for the Giants, who had won four of five prior to Wednesday's setback. Tim Lincecum (4-11) was handed the loss for giving up five runs on seven hits along with three walks and eight strikeouts over just 4 2/3 innings.

"I go to the chalkboard after every start and try to figure out what's going on," Lincecum said. "I have to figure out how to make something better or a change. It's a game of chess. You've got to keep adapting, making different changes just to come out on top. That's where I'm at."

Headley gave the Padres the lead in the first with a solo homer in the first, but the Giants got it back in the bottom of the inning when Gregor Blanco singled, stole second, moved to third on a sac bunt and came home on Cabrera's sac fly.

San Diego went on top for good in the fourth as Guzman singled and Everth Cabrera walked. After Jason Marquis struck out for the second out of the inning, Venable smacked a double to left-center to score both runners for a 3-1 lead.

Guzman's two-run shot in the fifth made it a four-run game and he added his solo shot to start the eighth for a 6-1 lead.

A wild pitch from Marquis and RBI single by Theriot in the eighth got the Giants within three, but Huston Street, who got the final out of the eighth with runners on the corners, worked around a two-out double from Brandon Belt in the ninth to pick up his 17th save of the season.

Game Notes

Despite the loss, the Giants have still won six of nine against the Padres this season...The Giants host the Dodgers for three games starting on Friday...The Padres play three games in Miami beginning on Friday...Marquis improved to 6-5 in 15 games (14 starts) against the Giants...Lincecum fell to 10-5 in 21 starts against the Padres.