Hardy, who is 12-for-29 (.414) on Milwaukee's 10-game road trip, has been hot since resting his sore left shoulder.
"It's the best it's been all year," Hardy said. "I think earlier in the season, I couldn't get extended."
Hardy had no trouble extending against Johnson, whom he touched for a two-run homer in the first and a solo shot in the second, his seventh and eighth homers of the season.
"It was off Randy Johnson, who's one of the best pitchers ever," said Hardy, who graduated from Tucson's Sabino High School in 2001, the year Johnson helped pitch the Diamondbacks to a World Series title. "It's really exciting for me."
Joe Dillon also homered for the Brewers, who beat Arizona for the fourth time in five meetings. The NL West leaders dropped to 42-42 and saw their lead over the Los Angeles Dodgers shrink to 2 1/2 games.
Salomon Torres got three outs for his 14th save in 16 chances.
Arizona's Conor Jackson drove in three runs with three hits, including his eighth homer.
The Big Unit (4-7) allowed seven runs and eight hits in 3 2/3 innings, his shortest start of the season.
The outing extended a discouraging trend for the 44-year-old Johnson, who has 288 victories.
It was the third time in four starts Johnson has given up seven earned runs, and his ERA has climbed to 5.46. The Big Unit's personal six-game skid is his longest since he lost eight straight decisions with Seattle in 1992.
"It's been a month's worth of poor games," Johnson said. "Obviously, I'm very much aware of that. I'm a little disappointed, obviously. That goes without saying. You just try to regroup and you look forward to your next start."
After Dillon led off the game with a walk, Hardy hit an 0-1 pitch 405 feet into the seats high above center field. Then Rivera singled to give the Brewers a 3-0 lead.
Arizona got a run back in the first on Jackson's two-out single.
The Brewers stepped up their assault on Johnson in the second. Jason Kendall led off with a single, and Dillon hit an 0-2 delivery into the Arizona bullpen down the left field line for his first homer.
Hardy followed with a 384-foot shot into the bleachers in left to put Milwaukee up 6-1.
Manager Bob Melvin lifted Johnson after Corey Hart's RBI single made it 7-1 in the fourth.
"We know he's not the same as he used to be," Hardy said of Johnson. "He's not throwing 100 miles an hour with 93 mile-an-hour sliders. But he's still a really good pitcher and it's nice to get out there and get off to an early start."
Johnson's fastball peaked in the high 80s, and when he missed his spots, the Brewers made him pay.
"Velocity is a luxury," Johnson said. "I don't have the same velocity. But location is a necessity in pitching, and I haven't had any of that."
Johnson left to a smattering of applause and flipped his glove to a youngster sitting in the first row behind the dugout.
"From where I've been to where I'm now, and a little bit of everything in between, just disappointed," Johnson said.
Arizona closed within 7-5 on Jackson's two-run homer in the fifth.
The Diamondbacks couldn't come any closer on a night the Brewers turned in three superb fielding plays. Two were by third baseman Bill Hall and the other by reserve first baseman Mike Rivera, who turned a diving snag into an unassisted double play to thwart an Arizona threat in the eighth.
"There was a couple of plays that might have saved the game," Brewers manager Ned Yost said. "Defense was spectacular tonight."
Melvin, groping for positives, said he was pleased his team didn't quit.
"That was a really good comeback effort by us," he said. "Came up a little bit short, but not due to the lack of good at-bats."
All the runs came off Brewers starter Jeff Suppan (5-6), who gave up nine hits in five innings.
Arizona has rallied from a six-run deficit to win five times, most recently June 19, 2007, against Tampa Bay. ... Jackson started in left field in place of Eric Byrnes, who went on the 15-day DL with a strained left hamstring, his second DL stint with a hamstring injury this season. ... With Chris Snyder on the 15-day DL with a left testicular fracture, Montero will take over as Arizona's everyday catcher. ... Before going deep Tuesday, Dillon had one homer in his first 169 major league at-bats.