The left-hander used that experience to his advantage on Wednesday night.
The Cardinals, who are 18-9 since the All-Star break, captured their sixth successive series after taking the first three of the four-game set.
Gomber gave up three hits, struck out six and walked four. He wriggled out of a pair of jams while nursing a 1-0 lead.
"I think being in the bullpen kind of helped me in these situations," Gomber said. "Even when the bases get loaded, I never feel any panic. It's just something that you've got to become more comfortable with."
Gomber ended his 99-pitch outing by striking out three successive batters after giving up a leadoff double to Bryce Harper in the sixth.
"This guy gets after it," St. Louis interim manager Mike Shildt said. "He's not going to back down from anyone."
Gomber (3-0) struck out Michael A. Taylor looking with the bases loaded to end the fourth. He retired Anthony Rendon on a flyball with runners on first and third in the fifth.
Daniel Murphy homered in the ninth for Washington, which has lost four in a row and seven of nine to fall below .500 and nine games behind the first-place Atlanta Braves in the NL East. The current skid began with a loss to the Cubs on a two-out, walk-off grand slam.
"When you're in a playoff race, we've got to score first, we've got to score early," Nationals manager Dave Martinez said. "We can't squander the opportunities that we get and we've been doing that."
Ozuna homered in the second inning, his 14th of the season and his first since July 30, covering 62 plate appearances.
Bud Norris pitched the ninth to pick up his 23rd save in 27 opportunities,
St. Louis infielder Matt Carpenter extended his on-base streak to 33 games with a walk in the fifth. It's the longest current streak in the majors. Carpenter left the game in the seventh after he was hit on the hand by a pitch from Matt Grace, but X-rays were negative.
Carpenter does not expect to miss any time.
"The pain and swelling started to go down a bit," Carpenter said. "I definitely dodged a bullet there."
Washington starter Jeremy Hellickson (5-3) left in the fifth inning after he fell on his wrist on a play at the plate following a wild pitch. Hellickson gave up three runs, two earned, on three hits in 4 1/3 innings. He struck out two and walked two.
Hellickson realizes the Nationals' chances of making the postseason are dwindling.
"We're going to need a lot of help, that's for sure," Hellickson said. "We've made it pretty tough on ourselves here."
Bader, who had three hits, also made a diving catch of a liner off the bat of Harper in the fourth. Bader scampered home on a wild pitch in the fifth inning for a 2-0 lead.
"We've known all year that we're capable of playing this type of baseball," Bader said. "It's nice to see it come out in between the white lines. Everything's rolling together and we're just going to try and preserve it the best we can."
The Cardinals, who have an NL-best 12-2 mark in August, remain one game behind Philadelphia for the second wild-card spot. They are four games behind Chicago in the NL Central.
Nationals: RHP Stephen Strasburg (pinched nerve in neck) threw a simulated game on Wednesday. He threw around 70 pitches and could be ready to return from the disabled list early next week, manager Dave Martinez said.
Cardinals: LHP Brett Cecil was activated from the DL on Wednesday. Cecil, who had been sidelined with inflammation in his right foot, pitched four scoreless innings in four appearances with Triple-A Memphis. LHP Tyler Webb was optioned to Memphis.
RHP Tanner Roark (7-12, 4.12) will face RHP Luke Weaver (6-10, 4.66) in the finale of the four-game series on Thursday. Roark has won his last four decisions. Weaver is 1-4 with a 5.13 ERA in nine career games against NL East foes.
More AP baseball: https://apnews.com/tag/MLBbaseball and https://twitter.com/AP-Sports
Roy Halladay's Hall of Fame plaque won't have a team's logo on hat
At the wishes of Roy Halladay's family, the late pitcher's Baseball Hall of Fame plaque won't have a team logo on his hat. Halladay spent his career between the Toronto Blue Jays and Philadelphia Phillies.
Will Ichiro do anything with the Mariners in 2019?
Pardon The Interruption's Mike Wilbon and Tony Kornheiser debate whether Ichiro will even get five hits with the Mariners this season.
Why Bonds, Clemens will be Hall of Famers
Will Cain explains why Barry Bonds and Roger Clemens will make the National Baseball Hall of Fame before their the eligibility expires in three years.
Mariano was simply spectacular
Take a look back at some of Mariano Rivera's career highlights as he becomes the first player to be unanimously voted in to the Baseball Hall of Fame.
David Stearns gets contract extension, promoted to Brewers president of baseball operations
The Milwaukee Brewers promoted general manager David Stearns to president of baseball operations and extended his contract Wednesday.
Why a unanimous Hall of Famer is great for baseball
Cooperstown is a better place now that Mariano Rivera got 100 percent of the BBWAA vote.