Hoffman (1-2) came on in the bottom of the ninth to hold a 3-2 lead but he walked Albert Pujols with one out and then served up a low fastball that Holliday drilled over the fence in straightaway center field at Miller Park.
Pujols hit his 45th homer of the season for the Cardinals, who have won nine of their last 11 games.
Blake Hawksworth (3-0) was credited with the win after pitching a scoreless eighth inning in relief of John Smoltz, who game up three runs on six hits and struck out seven in five innings. Kyle McClellan earned the save, his third.
Prince Fielder had a two-run homer for the Brewers, who have six losses in their last eight games.
The Brewers used seven pitchers in relief of starter Manny Para, who left the game after one inning due to neck spasms.
Copyright 2009 by United Press International.