Ricardo Rodriguez's second-half penalty had cancelled out Ronaldo's earlier free kick, but the 34-year-old scored twice in the final three minutes to earn the European champions a place in Sunday's final.
The first opportunity of the game went the way of Switzerland, with Xherdan Shaqiri being denied from close range by Rui Patricio, but Portugal were also carrying a threat through Bernardo Silva and Ronaldo.
Both teams were fortunate not to have a player dismissed as Bruno Fernandes and Granit Xhaka went into two separate tackles with their studs showing, and the exchanges only contributed to an high-octane first 15 minutes.
Ronaldo dragged Portugal's first shot wide of the post from 20 yards, while Pepe headed over when he should have at least hit the target, but Switzerland remained lively at the other end with Haris Seferovic sending a header straight at Patricio.
However, it was not long before Portugal took the lead. Ronaldo was fortunate to win a free kick on the edge of the area, but the Juventus forward took full advantage by firing the set piece into the far bottom corner.
The game continued to follow a similar pattern as both teams went in search of goals, although the only other clear-cut opportunity before the break came when Seferovic struck the crossbar from 12 yards after being found by Kevin Mbabu.
VAR had not been required during the opening 45 minutes of the contest, but both teams felt that they had claims for a penalty after two incidents in the space of 30 seconds.
There was little doubt that Bernardo had been fouled by Fabian Schar at one end, but it was Switzerland who got the spot kick with Nelson Semedo having tripped Steven Zubar as he attempted to meet a Shaqiri cross.
Rodriguez was given the responsibility from 12 yards, and the left wing-back's scuffed effort was helped into the bottom corner by Patricio.
Switzerland remained on the front foot and Seferovic should have perhaps done better with a header at the back post, but Portugal still threatened through long-range strikes from Fernandes and Ruben Neves.
A number of substitutions disrupted the flow of the game, and a lack of urgency from both sides during the closing stages left extra time as an increasingly possibility.
However, Ronaldo changed that with two minutes left. Bernardo controlled a long pass before providing the perfect cutback for the forward, who found the bottom corner with a first-time effort from 14 yards out.
Switzerland were required to commit men forward in search of an equaliser, although that only left space available for Ronaldo to quickly complete his treble.
The veteran was able to cut inside onto his right foot from the corner of the penalty area, and he took his time before sending a low shot into the far bottom corner to set up a showdown with the Netherlands or England on Sunday evening.
PORTUGAL (4-3-3): Patricio; Semedo, Pepe (Fonte 63'), Dias, Guerreiro; Fernandes (Moutinho 91'), Carvalho, Neves; Bernardo, Ronaldo, Felix (Guedes 70')
SWITZERLAND (3-5-1-1): Sommer; Schar, Akinji, Rodriguez; Mbabu, Zakaria (Fernandes 71'), Freuler (Drmic 89'), Xhaka, Zuber (Steffen 83'); Shaqiri; Seferovicbody check tags ::