Mitch Keller (5-11) pitched out of trouble with the aid of two double plays to hold off the Reds, who are chasing the streaking St. Louis Cardinals for the second NL wild card. They trail St. Louis by four games with 10 remaining.
''Yes it sucks. It really does. They are getting harder to take,'' Cincinnati shortstop Kyle Farmer said. ''We had our shots, we didn't take advantage. It is quiet in the clubhouse, like the wind got knocked out of us.''
Gamel hit his eighth home run in the fourth inning to erase the Reds' early lead in the fourth. Hayes singled to score Hoy Park, and Cole Tucker sent Hayes home with a single.
''It feels a lot better than losing 13 straight as we have here,'' Derek Shelton said. ''This was a good team victory tonight. We did a lot of things well.''
The Reds failed to get a hit in key situations, scoring on a double play with runners at the corners and on TJ Friedl's bases loaded sacrifice fly.
''We've seen a lot of growth from Mitch. He really managed that inning, limiting them to one run with the bases loaded,'' Shelton said.
Cincinnati loaded the bases with no outs in the seventh, but Nick Castellanos and Joey Votto popped out and Nick Mears struck out Farmer looking. Farmer had three hits, but Cincinnati stranded 11 baserunners.
''We had the leadoff runner on a lot,'' David Bell said. ''We had the big opportunity with the bases loaded and the guys we wanted up. It certainly felt like we were going to win that game.''
Keller matched his season high with 5 2/3 innings, allowing two runs on seven hits. He won for the first time since Aug. 20.
''It's huge. They're a really good hitting team,'' Keller said. ''When they get hot, they feed off each other. We did a good job as a group of keeping them off the plate and keeping them uncomfortable. The defense behind us was great, turning double plays on the wet grass.
Tyler Mahle (12-6) was relieved after 4 1/3 innings, giving up three runs on six hits.
The Pirates scored three runs off Michael Lorenzen in the eighth.
The Reds have not won a series since completing a four-game sweep of the Miami Marlins on Aug. 22. They need a win in Wednesday's series finale to avoid losing nine straight series.
Pirates: IF/OF Michael Chavis continues a rehab assignment with Indianapolis. He is 6 for 15 with four RBIs in four games, recovering from a strained right elbow.
Reds: Bell told reporters that LHP Wade Miley has been dealing with a stiff neck. Miley is being monitored by trainers and expected to make his next start.
Reds RHP Luis Castilo (8-15, 4.08 ERA) makes his 32nd start of the season Wednesday in the series finale. Pittsburgh named Connor Overton 0-0 with no ERA in three games with the Pirates.
--- More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports
Copyright 2022 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.