"I've never faced a situation like that," Sanchez said after delivering his first career walk-off hit. "I was just looking for a good pitch to swing at and get to the outfield somehow."
Buster Posey opened the 11th inning with a single. Burriss replaced him at first. After Angel Pagan sacrificed Burriss to second, Brandon Belt was walked intentionally. Ryan Theriot walked to load the bases ahead of Sanchez, who hit a 3-2 pitch into left field for the win.
"I was prepared to hit three innings before that," Sanchez said. "When they put in a runner for Posey I knew I would be pinch-hitting. I try to be ready for anything, playing defense or hitting."
Sanchez was ahead in the count 3-0 before Dillard came back with back-to-back strikes.
"He looked comfortable, poised, in that situation," Giants manager Bruce Bochy said. "It's not easy for a young player to control his adrenaline. He didn't try to do too much with it. He just put it in play."
Javier Lopez (3-0) got the final out of the 11th for the victory.
Matt Cain pitched seven strong innings and ended with another no-decision after Santiago Casilla recorded his first blown save of the season.
"You just have to go ahead and make your pitches and not try to make something special happen," Cain said. "You just work on getting the out. I was a little bit iffy there walking [Nyjer] Morgan on four pitches to start the game."
The Brewers tied the game in the top of the ninth, getting a two-out double from pinch-hitter and former Giant Travis Ishikawa. Corey Hart, who reached on a fielding error, scored the run.
Ishikawa kept his at-bat alive by fighting off a few tough full-count pitches from Casilla. Angel Pagan tried to make a diving catch in left-center, but the ball bounced just in front of his glove.
Hart also ran into a double play in the top of the 11th. He led off with a single against Clay Hensley and was rounding second when Jonathan Lucroy's line drive was snared by Melky Cabrera in left field.
"He saw where the ball was, he thought the ball may have a chance to drop in, which we thought it may, also," Brewers manager Ron Roenicke said. "He went a little bit too far."
Hart was slow in returning to first base, partly because he had to go back and tag second. Roenicke was fine with Hart's hustle on that play.
Conor Gillaspie, Pagan and Theriot also each drove in a run for the Giants, who won their second straight following a four-game slide.
Cain allowed two runs on six hits, walked one and struck out 10. He is 0-3 in his last four starts despite a sparkling 2.08 ERA in that span. Sergio Romo pitched a perfect eighth before Casilla entered.
"He's relentless in how he approaches the game," Bochy said of Cain. "What a job he does on a consistent basis. He did his job. That's just bad luck."
Cain retired 12 consecutive Brewers at one point during the contest.
"He's always tough," Brewers third baseman Aramis Ramirez said. "Especially here at home, he's always pitched well. He's one of the best pitchers in the game, and he ain't going to make too many mistakes. When he makes them, you have to make him pay, and we didn't."
Pagan extended his career-best hitting streak to 20 games with a leadoff double in the fourth. He joins Pablo Sandoval as the only pair of San Francisco teammates to each record a hitting streak of at least 20 games in the same season. Willie Mays, who turned 81 on Sunday, and Don Mueller were the last Giants to do it, each with a 21-game hitting streak in 1954 while the club was still in New York.
"He's found his swing," Bochy said. "All spring long he was working on it, and at the start of the season it wasn't quite there. You don't like moving a guy around when he's on a streak like that, but he gives you a quality at-bat hitting first or fifth."