The 29-year-old booked her place in the semi-finals with a 4-6 6-3 6-2 result over Safarova, marking her ninth consecutive win.
"I could have had a better chance in the first set but I lost some key points," said Williams.
"It was all about maybe one or two points here that would've made a difference and some silly double faults that didn't make sense."
She will now face Victoria Azarenka for a place in the Toronto Cup final.
Williams, ranked 79 in the world, returned to tennis in June after eleven months out of the sport due to injury problems.