PHOENIX (AP) — Zac Gallen pitched seven effective innings despite an early bout of wildness, and the Arizona Diamondbacks used a four-run eighth inning to top the Cincinnati Reds 7-4 on Wednesday.

Geraldo Perdomo hit a two-run homer for the Diamondbacks, who avoided a sweep after the Reds took the first two games of the series.

Arizona went ahead to stay on David Peralta’s one-out RBI single against Art Warren (2-3). Pavin Smith drove in Ketel Marte with a fielder’s choice, and Perdomo’s RBI single lifted the Diamondbacks to a 6-3 lead. Smith scored on a balk by Reiver Sanmartin.

Brandon Drury hit his 13th homer for Cincinnati, which had won three in a row. Luis Castillo pitched seven innings of four-hit ball.

Gallen settled down after a brutal start. The right-hander hit four of his first eight batters, two in the first and two in the second.

The four hit batters set a Diamondbacks franchise record. It was one shy of the modern-day record set by Brooklyn’s Oscar Jones, who hit five batters in a game in 1903, according to Elias.

The Diamondbacks answered in their half of the second. Doubles by Peralta and Alek Thomas produced the team’s first run, and Perdomo made it 3-2 when he connected for his second homer on a first-pitch fastball.

Three good defensive plays in a row helped out Gallen in the bottom of the fifth. Thomas made a running grab of a smash to the left-center warning track by Aramis Garcia, and Josh Rojas then turned in two excellent plays in a row.

India hit a hard grounder to Rojas’ backhand that he fielded cleanly and then threw to first. Then the third baseman made a diving catch on a sinking liner by Drury.

Gallen retired his final 16 batters. He struck out five and allowed just two hits without walking a batter.

Noe Ramirez (2-1) surrendered the tying homer to Drury with two outs in the eighth, ending Gallen’s chance for the win.

TRAINER’S ROOM

Reds: OF Albert Almora Jr., who was removed from the lineup late in Tuesday’s game due to a leg injury, went 1 for 4.

UP NEXT

Reds: Following Thursday’s off day, RHP Hunter Greene (3-7, 5.10 ERA) faces visiting Milwaukee on Friday for the opener of a three-game series. The Brewers have not yet announced a starter.

Diamondbacks: Off Thursday before beginning a three-game series against Minnesota. LHP Madison Bumgarner (2-6, 3.50 ERA) faces Twins LHP Devin Smeltzer, (3-0, 2.38 ERA) on Friday.
The Reds pushed across two in the second when Gallen had a throwing error on a pickoff attempt and Jonathan India hit a run-scoring double into the left-field corner.