Sagan (Tinkoff) outsprinted Lotto-Soudal's Andre Greipel and Alexander Kristoff (Katusha) to claim victory in the 202km stage from Aalter to Leeuw-St-Pierre in Belgium.
The finishing photo decided the winner.
“I didn’t know I’d won because it was very close with André and after I was waiting for the final result, but I’m very happy with the win because it’s another case of very good timing with the headwind finish," Sagan said.
"It was a nervous sprint at the end and I had to hold my line next to Démare, but that’s sprinting."
A 10-second time bonus for the victory was enough to take the overall lead from Dennis (BMC), who is now seven seconds back in second while Jos van Emden (LottoNL-Jumbo) lies in third at 12 seconds.
Just 50km into the stage, Belgian one-day classics specialist Tom Boonen pulled out of the race after crashing when his front wheel hit a pothole as he was eating.
Boonen was taken to hospital for further diagnosis and treatment and was later cleared of serious injury and released. He will resume training next week.
The fifth stage is a 20.9km team time trial around Sittard-Geleen in the Netherlands where Dennis may be able to regain the overall lead.
“I was pretty confident that I was going to lose the jersey today but I said to Joey Rosskopf last night that it probably isn’t a bad thing because then I get to wear our team skin suit instead in the TTT," Dennis said.
"The ideal situation was that Sagan only gained one second on me but he’s got seven. It’s not the end of the race but we just have to make up the time.”
The Eneco Tour finishes in Geraardsbergen in Belgium on Sunday.