The Italian has lifted the past three Masters 1000 titles - at Paris, Indian Wells and Miami - without conceding a set.
However, his streak of 37 consecutive sets was suddenly snapped when he lost control in the second set and Czech Machac took advantage to win the tie-break.
It was the first time Sinner had dropped a set at that level since October's Shangai Masters, when he retired injured against Netherlands' Tallon Griekspoor.
But Sinner regained his composure in Monaco to see out the decider and complete a 6-1 6-7 (3-7) 6-3 victory- his 19th in a row at a Masters tournament.
The second seed, who has never won a clay-court Masters 1000 title, will face Canadian sixth seed Felix Auger-Aliassime in the last eight.
If Sinner wins the Monte Carlo tournament he will replace Carlos Alcaraz as the world number one when the rankings are updated on Monday.
He has no ranking points to defend until the Italian Open at the start of May because he was serving a three-month suspension this time last year for failing two doping tests.
Alcaraz continued his title defence bid in Monte Carlo after he recovered from an error-strewn second set to beat Argentina's Tomas Martin Etcheverry 6-1 4-6 6-3.
After surging through the opening set in 26 minutes, the Spaniard's levels dipped and he hit 23 unforced errors in the second before regrouping to strike 13 winners in the decider.
The seven-time Grand Slam champion will face eighth seed Alexander Bublik in the quarter-finals after the Kazakh defeated Miami Open runner-up Jiri Lehecka in straight sets.
Meanwhile, women's world number one Aryna Sabalenka has withdrawn from the Stuttgart Open because of injury.
"I'm very sad to say that I won't be able to play the Porsche Tennis Gran Prix this year," she posted on Instagram.
"Unfortunately I suffered an injury after Miami, and even though I tried everything to recover in time, I'm not ready to compete."
Sabalenka became just the fifth female player to win the 'Sunshine Double' last month when she followed up her Indian Wells triumph with success in Miami.
The Belarusian, who is a four-time runner-up in Stuttgart, will be replaced by Poland's Magdalena Frech at the tournament, which starts on Monday.