Hudson gave up two unearned runs in six innings but he was outpitched by Cole Hammels, and Chase Utley had a tiebreaking RBI single in the fifth inning to lift the Philadelphia Phillies to a 2-1 victory over the Giants on Thursday.
"You're hoping your guy gives you a chance, and that's what (Hudson) did," San Francisco manager Bruce Bochy said. "He pitched great."
Hamels (5-5) got the better of Hudson in a matchup between starters who have combined for seven All-Star appearances. The Philadelphia left-hander gave up six hits while striking out 10 and walking one.
Hudson (8-7) gave up two runs in six innings although both were unearned. The right-hander struck out six and walked two.
The Giants, who were looking for their first four-game sweep in Philadelphia since 1998, lost for just the second time in eight games. San Francisco's lead over the idle Dodgers in the NL West dropped to 1 1/2 games entering this weekend's three-game series between the rivals at AT&T Park.
Despite the defeat, the Giants return home feeling positive after a 5-2 road trip.
"That's a really good road trip," Bochy said. "We've got a big series ahead of us. It's going to be a good, exciting series. It's what you play for."
Added Hudson: "It's a big series for us. Every series against those guys is going to be big from here on out."
The Phillies got some help on both of their runs off of Hudson.
"It wasn't one of my prouder moments, but I crossed him up in the first inning and it essentially cost us a run," Hudson said. "I forgot that we changed our signs."
San Francisco tied the game in the fifth on Ehire Adrianza's RBI single to center.
Philadelphia got some more good fortune in the bottom of the frame as Ben Revere opened the inning with a medium fly ball to left. Michael Morse charged hard but couldn't come up with the grab and the error allowed Revere to reach second. Revere scored on Utley's single to center.
"He made a long run for that ball and just couldn't quite hold onto it," Bochy said of Morse. "I've been happy with what he's done in left field."
Utley, Byrd and Wil Nieves had a pair of hits for Philadelphia, which snapped its four-game losing streak while winning for just the second time in nine games.
Jonathan Papelbon pitched a scoreless ninth for his 24th save in 27 opportunities to stop a rocky stretch. Papelbon blew his third save in Tuesday's 9-6, 14-inning defeat and took the loss in Wednesday's 3-1 loss.
He was booed upon entering the field and then again when he was introduced by PA announcer Dan Baker.
Papelbon pitched a 1-2-3 inning to tie Goose Gossage for 21st place on the all-time save list with career save No. 310.
Philadelphia slugger Ryan Howard wasn't in the lineup for the second straight day as Sandberg has decided to look elsewhere to find production from first base. Howard has been in a power drought with just one homer since June 19 and his .224 average, .377 slugging percentage and .682 on-base plus slugging mark are well off his usual production.
The move was eye-opening considering the three-time All-Star and former MVP's dominance against Hudson, against whom he has batted .328 with seven homers and 17 RBIs in 67 career at-bats.
Howard's replacement, Darin Ruf, went 1-for-4 with a strikeout.
"I wanted to see (Ruf) play for a couple of games, get him some at-bats and basically go from there," Sandberg said. "We'll continue to watch."
Sandberg met with Howard prior to the game and Howard said he wanted to be in the lineup. But the manager made no promises, adding that a platoon with the right-handed hitting Ruf was possible.
Hamels cooled off Hunter Pence, who went 0 for 4 with three strikeouts. Pence entered batting .412 with a homer and six RBIs in the series, including the game-winning double in Wednesday's 3-1 Giants victory.
"I don't ever recall his fastball being as good as it was today," Hudson said. "His fastball had some juice on it and his off-speed was as good as I've seen it."
NOTES: Adrianza strained his right hamstring running the bases in the fifth inning. Bochy said he'll be evaluated further on Friday. ... The Giants open a pivotal three-game series at home against the rival Dodgers on Friday with San Francisco right-hander Tim Lincecum (9-6, 3.68) opposing Los Angeles right-hander Zack Greinke (11-6, 2.90). . Philadelphia hosts Arizona for a three-game set that begins Friday when Diamondbacks lefty Wade Miley (6-6, 4.16) takes on Phillies right-hander Kyle Kendrick (4-10, 4.87). .