San Diego got into a jam in the seventh when relievers Trey Wingenter and Adam Warren combined to issue three straight walks on 12 straight pitches with one out. Allen then struck out Dyson and got Ketel Marte to ground out to first.
Kirby Yates pitched the ninth for his 18th save.
Arizona manager Torey Lovullo said Zack Godley (1-4, 7.90) is being moved to the bullpen.
Diamondbacks: RHP Zack Greinke (6-1, 2.78) needs three strikeouts for 2,500 in his career. When he started at San Diego on April 2, he struck out 10 and hit two home runs in an 8-5 win. He’s 13-2 with a 2.30 ERA and 156 strikeouts against 31 walks in 24 career starts against the Padres.