The rookie right-hander took a no-hit bid into the seventh inning, Ketel Marte hit a grand slam for his 30th homer and the Arizona Diamondbacks beat the San Diego Padres 4-1 Wednesday to complete a three-game sweep.
The 24-year-old Gallen (3-4) struck out eight, walked one and allowed one hit on 103 pitches while lowering his ERA to 2.50. Arizona is 5-1 in his starts since acquiring him from Miami on July 31.
"I took a look at the pitch count and I knew it probably wasn't going to be possible," Gallen said. "I just tried to get it going as long as I could."
Gallen pitched seven hitless innings in the minor leagues earlier this season, but that was as close as he'd ever been to a no-hitter.
"Another night of outstanding pitching and it carried us throughout the entire night," Diamondbacks manager Torey Lovullo said. "I was probably the most nervous guy in the stadium, because I was trying to figure out how I was going to take him out of a game if he had a certain pitch count."
Marte's slam off Luis Perdomo set Gallen up for the victory and gave the surging Diamondbacks their ninth win in 10 games.
Machado broke up Gallen's no-hitter with a line drive with one out in the seventh. Diamondbacks right fielder Jarrod Dyson set up as if he was going to try to throw out Machado at first base, but he bobbled the transfer.
With the Chicago Cubs idle Wednesday, the Diamondbacks moved within three games of the second NL wild card.
Craig Stammen (7-7) took the loss after issuing two walks that turned into runs on Marte's slam, the second of his career. Starter Chris Paddack pitched 5 1/3 scoreless innings and allowed four hits with eight strikeouts.
"It was a pitching matchup. He was getting guys out. I was getting guys out. It was just kind of who was going to fall first," Paddack said.
Wil Myers homered in the ninth, his 16th of the season, for the Padres' only run. The Padres got the tying run up to bat in the ninth, but Archie Bradley got Hunter Renfroe on a broken-bat ground out for his 12th save and stranded runners at second and third. San Diego had just three hits.
Bradley has converted eight straight save opportunities.
Gallen got out of potential trouble in the first inning with help from teammate Josh Rojas. With San Diego's Greg Garcia on third base after being hit by a pitch and advancing to third on a fielder's choice, Machado lined out to Rojas in left field. Rojas fired a strike to home plate to get Garcia trying to score.
Marte took Perdomo into the seats in right field to break the scoreless tie. Marte joined Eduardo Escobar (33 home runs) as the first set of NL switch-hitting teammates to reach the 30-home run mark.
"I never thought I was going to have 30 homers," Marte said. "I just feel good. I feel strong up there and I put my best swing and I'm never looking for the homer."
Padres second baseman Ty France lost his footing as a routine ground ball from Marte reached him in the first inning. France hit the dirt and Marte was awarded a base hit.
In the fourth, second baseman Wilmer Flores was given an error for dropping Machado's pop fly in shallow right field.
Padres: LHP Adrian Morejon (shoulder impingement) isn't expected to return this season. He's been on the 10-day injured list since Aug. 8. ... C Francisco Mejia is working his way back from a right oblique strain. He's been on the injured list since Aug. 30.
Padres: After Thursday's day off, the Padres send RHP Dinelson Lamet (2-3, 4.24 ERA) to the mound in the opener of three-game series Friday against the Colorado Rockies. Lamet has five or more strikeouts in all 10 of his starts this season.
Diamondbacks: LHP Robbie Ray (12-7, 3.97 ERA) gets the ball at Cincinnati in the opener of a three-game series Friday. The Diamondbacks have six games remaining in the regular season against the Reds, with three more at home.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
World Series Daily: Los Angeles Dodgers eye first title in 32 years as Tampa Bay Rays try to force Game 7
Tampa Bay sends Blake Snell to the hill Tuesday night, while L.A. counters with a bullpen game. Will the Commissioner's Trophy make an appearance?
World Series 2020: Our impressions from inside Globe Life Field
Our reporters have been covering the Fall Classic from inside MLB's newest ballpark. Here's what they say about a stadium few have seen in person.
World Series 2020: What Tampa Bay Rays, Los Angeles Dodgers need to do from here
After a day off before the final game -- or games -- we map out the path to victory for both teams.
Doug Mathis, Brendan Sagara to share pitching coach duties for Rangers
The Texas Rangers plan to utilize Doug Mathis and Brendan Sagara as co-pitching coaches in 2021.
Los Angeles Dodgers fans get 'next best thing' with World Series drive-in
Dodger Stadium isn't hosting World Series games due to coronavirus precautions. But with two mega screens outside the stadium, fans are, at least, getting to come together for the experience.
New York Mets claim infielder Robel Garcia off waivers
The Mets claimed infielder Robel Garcia off waivers and designated outfielder Ryan Cordell for assignment.