Williams will face the victor of the quarter-final match between Simona Halep and Marie Bouzková, in the last four.
Andreescu beat American Sofia Kenin 6-4 7-6 (7-5) in the other semi-final and is the first Canadian woman to reach the final of the tournament since 1969.
Williams, meanwhile, who was recently ousted by Simona Halep in the Wimbledon final, looked in fine form against her Japanese opponent as she surpassed Arantxa Sanchez Vicario's record of 32 Rogers Cup wins.
Osaka said she played too defensively - something she said was hard to avoid when Williams was hitting 31 winners.
"My body just wanted to let it all out", she explained to the press afterwards.
Osaka said Williams played "amazing, which is what she does", and the victor agreed her level had improved from the pair of 2018 defeats.
Bouzkova quickly went up a double-break for a 4-1 lead and sealed the first set in 29 minutes but Williams quickly made the necessary adjustments and got her first break of the match to go ahead 4-3 in the second before forcing a decider. "So this is such a big learning experience for me". Beating the world's No. 1 player on Friday is pretty good sign that she is ready to go.
Williams spoke after her match but before she knew who she would face in the quarter-finals, saying either Osaka, who could return to the world number one ranking next week or Swiatek would be worthy foes.
That set the stage for Williams, a 37-year-old American who will try for a record-tying 24th Grand Slam singles title at the upcoming US Open, to again face Osaka after the controversial finish to their Grand Slam showdown last year in NY.
"Yeah, I mean, mentally, I mean, for me it's always fun to play her".
"Achilles problems. I felt since the first match here".
Osaka's run on the professional tennis courts has been wobbly since her Australian Open 2019 title and she admitted that she was not enjoying her stay on the WTA Tour since then. "Right now, I'm just really happy my mind and my body are holding up".
Meanwhile 19-year-old Andreescu will be trying to become the first Canadian in 50 years to lift the trophy.
In Montreal, top-seeded Rafael Nadal rallied to reach the Rogers Cup semifinals, beating No. 7 Fabio Fognini of Italy 2-6, 6-1, 6-2. Nadal has 82 singles victories, with his French Open triumph in June his second title of the year.