Halep had to grind out a 7-6(9) 4-6 7-5 win over Russian Anastasia Pavlyuchenkova earlier in the day, completing a match that began Wednesday but was halted due to rain.
Pavlyuchenkova, ranked 28th, took leads of 2-0 and 4-2 in the third set but was unable to finish off Halep, who won three games in a row to seize a 5-4 advantage and eventually went on to break Pavlyuchenkova for match point in the 12th game.
"It was a great match, a great fight. She played unbelievable and was fighting until the end," Halep told reporters in an on-court interview.
Against Williams, the 26-year-old Romanian saved the only break point she faced in the 74-minute match, and she converted five of her nine break opportunities.
Second seed Dane Caroline Wozniacki went down in her first match of the tournament, losing 5-7 6-2 7-6(4) to Aryna Sabalenka of Belarus.
Wozniacki was coming off a disappointing second round loss at Wimbledon and could not turn things around.
Great Britain's Johanna Konta was also forced to complete a pair of matches on Thursday. She finished off Belarus' Victoria Azarenka 6-3 6-1 but lost later to fifth seed Ukrainian Elina Svitolina 6-3 6-4.
"She was mentally more warmed up going into the match," Svitolina said. "That's what I thought. I was like, 'C'mon, you have to be ready (because) she will be straight in the match.' I think that really helped me."
France's Caroline Garcia cruised past former world number one Maria Sharapova of Russia 6-3 6-2, the same score by which Dutchwoman Kiki Bertens upset eighth seed Czech Petra Kvitova.
U.S. Open champion Sloane Stephens, the third seed, beat Spain's Carla Suarez Navarro 6-2 7-5 to book her spot in the quarter-finals, where she will face Latvia's Anastasija Sevastova, a 6-3 7-6(2) winner over German 10th seed Julia Goerges.
Belgian Elise Mertens, Australian Ashleigh Barty and Latvian Anastasija Sevastova also advanced with wins.
(Reporting by Frank Pingue in Toronto and Jahmal Corner in Los Angeles, editing by Pritha Sarkar and Sudipto Ganguly)