Late in the second set, Shapovalov was given a code violation for unsportsmanlike conduct after hopping over the net to show the chair umpire a mark on his opponent's side of the red clay court - which is not permitted.
The umpire determined that Shapovalov's serve was out, resulting in a double fault and a break point for Sonego. Then with the code violation, Shapovalov lost the game to trail 5-3.
"A lot of things happened in the heat of the moment. I need to be better with my behavior," Shapovalov said. "It was my mistake. I'll know the rule for next time. I definitely won't step over the net."
Even after stepping over the net, Shapovalov wasn't done arguing.
The 13th-seeded Canadian then called the chair umpire onto his side of the court and singled out a fan who was heckling him.
"I'm not going to kick him out because I didn't see what he was doing," the umpire said. "I saw you talking to him and you incited it a little bit. I understand you're frustrated."
After the match, Shapovalov apologized to the umpire.
Shapovalov reached the semifinals in Rome two years ago, while Sonego made the last four last year.
Sonego said he was penalized by a decision in the first set when the umpire came down to check a mark and made an overrule, awarding the point to Shapovalov when the Italian thought the point should have been replayed.
There was also a questionable overrule in the third set.
"Things like that shouldn't happen," Sonego said. "They should use video replay. That could be a big help for the umpire."
Video review was used for calling lines at last week's Madrid Open. But there is no such system in place in Rome.
Despite the vociferous fans, Shapovalov said he generally enjoys playing in Rome.
"The fans love me here and I love the fans," he said. "Even after the match, there were a lot of people standing, waiting for pictures, stuff like that.
"I'm super excited to play another match - not against an Italian."
Wawrinka recently returned to the tour after undergoing two foot surgeries last year.
Dominic Thiem, another former top-five player returning from injury, was beaten by Italian veteran Fabio Fognini 6-4, 7-6 (5). Fognini could play fellow Italian Jannik Sinner next - if Sinner gets by Pedro Martinez on Tuesday.
"He's our future star," Fognini said of Sinner.
Botic van de Zandschulp, a recent finalist in Munich, eliminated Sebastian Korda 6-4, 6-1.
Kerber, who was formerly ranked No. 1, has lost six straight matches.
Alcaraz pulled out because of a right ankle injury following his victory at the Madrid Open. Osaka cited a left Achilles heel injury.