Pegula, the 29-year-old American seeded fourth, finally broke through in the semifinals after falling in the round the previous two years.
"It was a great match," Pegula said. "It was tough. Kind of a roller-coaster. Really up and down, but I'm glad I was able to hold my nerve there at the end."
Pegula beat Swiatek a day after fellow American Tommy Paul knocked off top-ranked Carlos Alcaraz in the men's event in Toronto. U.S. players had not beaten the top-ranked man and woman in the same week since April 2008 in Miami when Serena Williams beat Justine Henin, and Andy Roddick topped Roger Federer.
Both players struggled to hold serve, with Swiatek breaking Pegula eight times. They only won 11 of 30 service games combined.
"I was getting frustrated that I wasn't holding," Pegula said. "But then at the same time I knew she was having trouble holding as well. I was just like, 'I know I'll get more chances if I can just ... hold.' Basically, it was whoever could kind of consolidate the break."
Rain forced the postponement of the night semifinal between third-seeded Elena Rybakina of Kazakhstan and 15th-seeded Liudmila Samsonova of Russia until Sunday. They are now scheduled to begin their match at 1:30 p.m. ET on Sunday, leaving the winner with little downtime before the final, which will begin "after suitable rest" and not before 5:30 p.m. Early Saturday, Rybakina outlasted 10th-seeded Daria Kasatkina of Russia 5-7, 7-5, 7-6 (8) in a match that ended at 2:54 a.m.
Swiatek leads the tour with 50 match victories. The Polish star won the French Open in June and added her fourth title of the year last week at home in Warsaw.
"I kind of knew what I had to do to push her. Sometimes I could do that, sometimes I was making more mistakes -- and I think that was the difference," Swiatek said. "But I tried to play aggressively for the whole match."
Pegula ended the match in 2 hours, 30 minutes, breaking Swiatek a final time after the top seed hit two shots long. Pegula had a chance to end the match much earlier, up 5-4 in the second set and serving, but Swiatek broke her serve to stay alive to take the set in a tiebreaker.
Pegula wondered if the service woes might have something to do with new balls. WTA players are testing out Wilson extra duty balls for the first time on hard courts this week, through next week and into the US Open.
"I don't know why this week all of us seem to be really having trouble, even girls that are considered the best servers on tour. It's weird," Pegula said. "It feels like the conditions, it's flying a little bit, it's swirling. I know it's also the first week we're playing with the Wilson extra duty balls.
"They're a little bit heavier, so they're not quite coming off the racket as well. Maybe we're not used to it."
The Associated Press and Reuters contributed to this report.