Sagan, who had also won Monday's third stage, was the strongest over the last few metres of the 180.5km run from Zernez and Bad Ragaz.
He finished ahead of Italy's Daniele Bennati and Philippe Gilbert of Belgium.
"I have to thank all my teammates for the amazing work they did to build this win," said Sagan.
"Today we knew was a great opportunity. The third category climb was the decisive point to get an orderly sprint."
"It's one step further for the Tour de France and my form is improving."
Frank has a 13-second lead over Portugal's Rui Costa and 23-second advantage over Czech rider Roman Kreuziger ahead of Sunday's concluding time trial in the village of Flumserberg.
For Sagan, it was his eighth career stage win on the race with two coming in 2011 and four last year.
Story continues below…
One of the day's biggest losers was Australia's Cameron Meyer who was forced to stop to change a wheel.
The Orica GreenEdge rider slipped from eighth to 10th place in the overall standings with a 2 min 09 sec deficit.