Heyward, Freddie Freeman and Juan Francisco homered for the Braves, who won their second straight after losing six of seven. Martin Prado and Brian McCann also drove in runs for the NL wild-card leaders.
"It's good to salvage a series going down 0-2 against a team that's hot," McCann said.
Heyward has six home runs and 12 RBIs in 10 career games at AT&T Park and is hitting .395 (15 for 38) there.
"He has to move out here, work on that home run swing during the offseason and then come hit in Turner Park," Hudson said.
Hudson (13-4) gave up five hits and beat the Giants for the sixth straight time. He walked one and struck out three. The right-hander has not lost since July 1.
"We were fortunate to get a couple of runs early and I was able to throw strikes," Hudson said. "You don't exactly see very well from a hitter's point of view and you have to pound the zone."
Tim Lincecum (7-14) lasted five innings, allowing three runs and seven hits. He walked two and struck out four.
"I was fighting myself a lot in that first inning to find a rhythm," Lincecum said. "My rhythm was just off in the first inning. I kind of got it back the next four innings but that was it. I was just getting behind batters 2-0 on pretty much everybody and wasn't really attacking the zone."
Lincecum allowed two runs in the first inning and one in the fourth, his two worst innings of the season. He's given up 25 runs in the first and 24 in the fourth. Both of his walks came within the first four batters of the game.
Prado had an RBI groundout and McCann added a run-scoring single for one of his three hits.
Francisco's home run put Atlanta up 3-0 in the fourth and Janish's first triple of the year -- the second of his career -- made it 5-0 in the sixth.
"That was huge," Hudson said. "You feel comfortable with where the game is at that point."
Hudson also singled in his first two at-bats, the second on a pop fly that was lost in the sun.
"That's smart hitting," Hudson said. "You hit it where the sun is. I've done that before."
The Giants loaded the bases with one out in the seventh, scoring on Crawford's sacrifice fly.
"It could have been a different game if I don't make pitches," Hudson said.
Heyward and Freeman homered on successive pitches from Clay Hensley in the ninth. Heyward, who has connected in three straight games, has been involved in all three back-to-back home runs for the Braves this season.
Braves 3B Chipper Jones received a standing ovation in what might have been his final at-bat at AT&T Park. He grounded out to shortstop. "Chipper is one of those guys around the majors that people respect," Atlanta manager Fredi Gonzalez said. "It's nice to have San Francisco fans recognize an opponent." ... Prado started at 2B, his fourth position in as many games (also SS, LF, 3B). ... The Braves send LHP Paul Maholm (11-8, 3.47 ERA) to the mound Monday night in San Diego. He ended a four-game losing streak to the Padres in their previous meeting. ... Hudson is 134-3 when given at least three runs of support. ... RHP Matt Cain (13-5, 2.83) goes for the Giants at Houston on Monday. Cain is 2-0 against the Astros this season, which includes his perfect game. ... San Francisco RHP Eric Hacker was optioned to Triple-A Fresno following Saturday night's game. The Giants recalled C Eli Whiteside to take his place. ... Posey has reached base with a hit or walk in 34 of his 38 games since the All-Star break.