Miley established himself as the frontrunner for Rookie of the Year, but his last four starts have not been up to his usual standards. He has a 6.44 ERA in those games to raise his season ERA from 2.90 to 3.32.
"I'm just going to put it behind me and want to get through these next four days and come back strong and finish strong," said Miley, who has one start left, next Monday against the Rockies at Chase Field.
Miley (16-11) got through the first two innings unscathed before things started to unravel for him in the third.
It started when opposing pitcher Matt Cain led off the inning with a single and Miley followed by walking Angel Pagan.
A sacrifice bunt moved the runners up and Pablo Sandoval beat out a grounder to short to score Cain. One batter later, Buster Posey lined a single to left to score Pagan and give Posey his 100th RBI of the year.
Miley's problems continued in the fourth when Brandon Belt led off with a triple and Brandon Crawford walked. Cain then tried to lay down a sacrifice bunt, but second baseman Aaron Hill dropped the throw to first for an error as the Giants loaded the bases.
One out later, Marco Scutaro drove in Belt with a single to left, and Sandoval grounded into a forceout allowing Crawford to score and give San Francisco a 4-0 lead.
"Not very good all from the start," Miley said. "I put us in a hole early and it's hard to win games when you're down 4-0 in the second or third inning. Just getting beat on bad pitches, not executing pitches. A little frustrated with myself in crucial situations getting beat with my fourth-best pitch."
Despite Miley's struggles Wednesday, Giants manager Bruce Bochy remains a fan.
"He's had a great year," Bochy said. "He's a good young talent. Our guys did a good job of using the whole field. They have a good staff over there of great young arms, and he's one of them."
Meanwhile, Cain (16-5) was making quick work of the D-backs. The right-hander needed just four pitches to retire the side in the first and he did not allow a hit until the fourth.
"He was throwing strikes, getting ahead, he was using three or four different pitches," D-backs first baseman Paul Goldschmidt said. "Obviously he has a fastball, but he throws a little cutter, a slider that's a little slower than that and moves a little more, curveball as well, and he was throwing those for strikes, getting ahead and keeping us off balance."
Cain wound up allowing just four hits and one walk over seven innings as he struck out six.
The D-backs had a couple of good scoring opportunities but could not cash them in.
Justin Upton and Miguel Montero led off the fourth with back-to-back singles, but were stranded.
Then in the seventh, Goldschmidt started the inning with a double and Gerardo Parra reached on a bunt single before Cain struck out the next two hitters and got pinch-hitter Jason Kubel to ground to first to end the threat.
"We had a few opportunities and weren't able to take advantage of them," Goldschmidt said. "And when you do that it's going to be tough to win."
The two teams complete the three-game series and their season series Thursday afternoon.