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
Chicago teams coordinate stay-at-home message
Chicago's sports teams are cooperating with the city to get out the message that fans need to stay at home.
Could South Korean Baseball provide template for MLB's return?
Jeff Passan describes how the MLB could replicate what the Korea Baseball Organization is doing to manage the coronavirus to start its season.
Second-Chance World Series Round 1: Sim tourney of MLB's best non-champs begins
Can the 2011 Rangers change history? How about the '94 Expos? Baseball's best to miss out on Fall Classic glory start their road to redemption in our upset-filled opening round.
Can the U.S. return to sports soon? South Korea might offer clues
While it's still too early to know when our pro teams will be back on the field, what's happening now halfway across the world could provide the blueprint.
How Roberto Clemente, Neil Walker are connected
With April 6 being the anniversary of Roberto Clemente's number retirement, Tim Kurkjian explains how Clemente is tied to fellow Pirate Neil Walker.
Tim Kurkjian's baseball fix: 'Never forget, it was Roberto Clemente throwing'
Plays that should have never been close were turned into outs when Roberto Clemente, in right field, had the ball in his hands and a runner trying to take an extra base in his sights.