Reds shortstop Kyle Farmer lifted a sacrifice fly to right field to score Tyler Stephenson for the winning run in the top of the 10th inning in the 2-1 win Tuesday at American Family Field.
The win extended the Reds' winning streak to five games and improved their record to 34-31.
"There was a different feel for [Castillo] before the game started, just a different level of focus," Reds manager David Bell told reporters. "There wasn't any sort of searching or wondering on his part.
"It was very focused and confident."
Castillo allowed just three hits and issued seven strikeouts to the Brewers in his seven innings of work. Anderson allowed just one hit and tossed nine strikeouts in his seven scoreless innings. Neither pitcher was on the record for a decision.
Anderson retired 17 of the first 18 Reds batters he faced. He allowed a third-inning single to Farmer, but followed that at-bat with nine-consecutive putouts. Castillo didn't allow a hit until the fifth inning.
Reds outfielder Nick Castellanos started the top of the 10th inning on second base, due to MLB's extra-innings rule. Brewers relief pitcher Brad Boxberger then hit Stephenson with a pitch in the next at-bat. Boxberger issued a walk to Joey Votto in the next exchange to load the bases.
He then hit Eugenio Suarez with a changeup to bring in Castellanos from third base, which gave the Reds a 1-0 lead. Reds outfielder Jesse Winker struck out in the next at-bat. Farmer followed with his sacrifice fly RBI to right field to push the Reds lead to two runs.
Willy Adames started the bottom of the inning at second base for the Brewers. Reds relief pitcher Heath Hembree struck out Jace Peterson and Jackie Bradley Jr. to start the half-inning.
Daniel Robertson followed with a single to right field, which plated Adames. Hembree walked Luis Urias in the next at-bat to put the go-ahead run on base for the Brewers.
The Reds brought in Amir Garrett to close out the game. Garrett struck out Tim Lopes in his lone exchange to earn his third save of the season.
Winker and Farmer were the only Reds players to record hits in the win. Brewers catcher Omar Narvaez went 2 for 4 in the loss.
The Brewers host the Reds in the final game of the series at 2:10 p.m. EDT Wednesday in Milwaukee.