The Serbian top seed, 34, was 5-2 up in the second set before being pegged back to 5-5 by the Canadian.
Djokovic will take on Norwegian fifth seed Casper Ruud for a place in the final.
Alexander Zverev will face Stefanos Tsitsipas in the other last-four tie.
Djokovic, who is aiming to win a sixth title in what will be his ninth consecutive semi-final in Rome, let out a huge roar as he closed out a tight first set.
However, after looking like he would take the second set with relative ease, Auger Aliassime proceeded to win the next three games and eventually pushed Djokovic all the way to a tie-break.
Asked whether Italy would be a fitting venue to secure his 1,000th Tour-level win, Djokovic said: "Yes, yes. Absolutely. Let's hope it can happen tomorrow."
In the other quarter-finals, German world number three Zverev, who lifted the title in 2017, cruised to a 7-5 6-2 win over the unseeded Cristian Garin.
Greek Tsitsipas, ranked fifth in the world, overcame Italian Jannik Sinner 7-6 (7-5) 6-2 in front of a raucous crowd.
Saturday's semi-final between Zverev, 25, and Tsitsipas, 23, will be the third time in the space of a month the pair have faced each other in the last four of an ATP tournament.
Tsitsipas beat Zverev on his way to winning the Monte Carlo Masters in April, before the German avenged that defeat in Madrid last week.
"He's a player that challenges me when I'm out on the court," Tsitsipas said of his rival.
"We have similar game styles, but he is one of the most difficult players on the tour. He has achieved a lot so far and I try to look up to him."
Zverev, who is yet to drop a set in Rome, said his match with Garin "wasn't pretty tennis" at times, but it was important he "got the job done".
Garin, 25, took the first break point to lead 3-2, but Zverev responded to take a 4-3 advantage before closing out the opening set.
He then took command of the second, converting two of his seven break points to wrap up the success.
Earlier on Friday, Tsitsipas raced to a 3-0 lead over Sinner in the first set before the home favourite battled back to draw level. Tsitsipas eventually edged the 10th seed on a tie-break.
After the Greek sailed through the second set, there was a stoppage in play at match point when a spectator fell ill. Following the restart, Tsitsipas dealt with Sinner's mistimed drop shot to claim the win.
Djokovic's last-four opponent Ruud continued his good form as he saved two set points against Canada's Denis Shapovalov for a 7-6 (9-7) 7-5 success.