PHOENIX (AP) Shelby Miller hit his first career triple and scored a run Friday night.
He held the Giants scoreless through five innings.
But Joe Panik's three-run home run in the sixth - on a 3-0 pitch - spoiled Miller's night and gave San Francisco a 3-1 victory over the Arizona Diamondbacks.
''I thought he threw the ball well,'' Arizona manager Chip Hale said. ''Panik ambushed him there 3-0. Other than that, he threw the ball well.''
Panik said he had never swung on a 3-0 pitch since he got to the major leagues.
But when manager Bruce Bochy gave him the green light to swing, he was ready.
''In a situation like that I'm excited because you've got a runner on third, nobody out, you're looking for a fastball,'' Panik said. ''I'm just looking for a pitch I can drive.''
It was Panik's second home run in two nights.
Jeff Samardzija (5-2) pitched out of trouble early and went eight innings for the third time this season, giving up a run and scattering eight hits to improve to 4-1 in his last five starts.
Samardzija's performance followed Johnny Cueto's strong effort in the Giants' 4-2 victory in the series opener Thursday night.
San Francisco's top three pitchers - Madison Bumgarner, Cueto and Samardzija - are a combined 14-5.
''You've got to keep pace, right?'' Samardzija said. ''It's awesome when you've got guys in front of you that are doing that and showing you the way, and you don't want to let everyone down.''
Miller (1-4) had tripled to deep center field and scored on Jean Segura's single in the fifth.
''At that point of the game I felt like, after getting that run in the bottom of the fifth, I felt that the momentum was on our side,'' Miller said. ''I was just frustrated about giving up three more runs in one inning. It gave them momentum with that home run and I was pretty upset about that. `'
Miller was tired after legging out the triple, and that could have contributed to his sixth-inning troubles.
''That is something that you always think about after the fact,'' Hale said. ''He hits a triple and has to run. It takes a little bit out of most pitchers.''
The triple certainly motivated Samardzija.
''It really fired me up, man,'' he said. ''I was not too happy with that. In a 0-0 game the last thing you want to do is break that tie giving it to the pitcher. I just wanted to make sure the rest of the game I redeemed myself.''
Miller went 5 2/3 innings, giving up three runs on seven hits.
The visitor won for the 22nd time in the last 27 meetings between the teams. Arizona fell to 5-14 at home.
The Diamondbacks matched a franchise record by turning five double plays, in the second, third, fourth, eighth and ninth innings.
Arizona stranded four runners, three in scoring position, in the first two innings.
Casilla said before the game he had apologized to manager Bruce Bochy for his emotional outburst on the mound in Thursday night's 4-2 victory. Casilla was upset when Bochy pulled him with two outs and the bases loaded in the ninth inning. Bochy brought in lefty Javier Lopez to face left-handed hitting Lamb and got the Arizona batter to ground out to preserve the victory.
Casilla said after the game that he thought Bochy had shown a lack of confidence but said after thinking about it overnight that he was wrong.
''What was said is between us,'' Bochy said. ''It's over.''
Giants: Angel Pagan was back in the lineup after missing 11 games with a hamstring strain. He singled and scored a run. ... RH reliever George Kontos was to make a final rehab appearance for Triple-A Sacramento Friday night. Bochy said Kontos could rejoin the Giants in San Diego on Tuesday.
Diamondbacks: OF David Peralta missed his fifth straight game with right wrist soreness. An MRI on Thursday did not reveal any structural damage.
Giants: RH Jake Peavy (1-4, 8.47 ERA) takes the mound in the third game of the series Saturday night after losing his last three starts, most recently a 3-1 defeat against Toronto on Monday.
Diamondbacks: LH Patrick Corbin ( 1-3, 4.12) goes for Arizona after pitching seven scoreless innings in his last outing, the Diamondbacks' 11-inning, 5-3 win at Atlanta on Sunday.