Miley pitched two-hit ball into the seventh inning and Eric Chavez drove in three runs, leading the Diamondbacks to a 7-0 victory over the Tampa Bay Rays.
Paul Goldschmidt hit his 24th homer, scored three runs and reached base four times. Cody Ross had three straight hits and drove in two runs as Arizona broke a three-game losing streak. It was Arizona's largest shutout win on the road since an 11-0 victory at San Francisco on Aug. 27, 2009.
"It's just refreshing for us," Chavez said. "We were struggling offensively, so it was really good to get off to a good start like that."
Hits by Martin Prado, Aaron Hill and Ross had produced two runs in the first inning. The stage was set when Hill barely beat out an infield single to load the bases, keeping the inning alive for Ross' two-run single.
"The way the game began took a little bit out of us and we never really recovered," Rays manager Joe Maddon said.
"We scored two in the first inning, two more in the third. That's huge," Miley said. "You get some support and you just want to go out and get the offense back in the box as soon as possible."
Arizona outhit the Rays 14-3. Every Diamondbacks starter except Cliff Pennington had at least one hit.
Ben Zobrist got two hits for Tampa Bay, which despite the loss finished its best month ever at 21-5.
"I really can't get too upset," Maddon said. "It's been a pretty good July, one of the funnest Julys I've ever participated in. They outplayed us tonight."
Miley (8-8) won for the fourth time in five starts. He struck out eight in 6 1-3 innings and walked five. Miley has made 11 straight starts of giving up three earned runs or fewer.
"He had good stuff. He knows how to pitch," Arizona manager Kirk Gibson said after the Diamondbacks' seventh shutout of the season. "He got into some situations and got himself out of those, made good pitches.
"He goes through times when he kind of gets out of it a little bit, but he's a guy that always seems to regain it and find it. He's got a good run for us now. He gave us a big performance tonight. It was a good win."
Jeremy Hellickson (10-4) gave up four runs and seven hits in 4 1-3 innings, the shortest Rays start since Alex Colome also went 4 1-3 innings on June 22.
Arizona added single runs in the seventh, eighth and ninth against three different relievers.
Miley descried his outing as "kind of erratic. I'd get ahead of a couple of guys, get behind a couple of guys, but I was able to make a pretty good pitch when I needed to, so it kind of got me out of some jams. And once again, Wil (Nieves) did a great job of knowing when to go to pitches and just kind of feel me out and stick with me the whole game. The defense played good. We scored a bunch of runs."
His biggest complaint was the baseballs.
"They didn't really feel rubbed up too well, so I kind of changed the grip a little bit on my sinker, just to get a feel for it," he said. "It was just slipping a little bit. It just felt like a brand new baseball, but you've got to deal with that sometimes."
NOTES: LHP Joe Thatcher, acquired by Arizona earlier in the day in a trade that sent pitcher Ian Kennedy to San Diego, will join the Diamondbacks in Texas on Thursday. ... Arizona RHP Zeke Spruill will get his first major league start Thursday against the Rangers. ... With LHP Matt Moore moving to the 15-day disabled list, the Rays will start Chris Archer, David Price and Roberto Hernandez in their weekend series at home against the San Francisco Giants.