The trio had broken away from a leading group with almost 37km to go on the Oude Kwaremont climb. They quickly gathered over a minute on the disorganised chasers behind and it became clear that one of them would take the victory in the Classic.
With only one attack in earnest from Gilbert to try and drop his rivals on the final climb of the course failing, all three seemed content to take it to a sprint.
The final kilometre saw them slow to almost a track sprinter pace as they sized each other up.
The most proficient sprinter, Van Avermaet, sat between Gilbert in front and Naesen behind, with Naesen launching his sprint first with 250 metres to go. Van Avermaet immediately followed as Gilbert lost some distance, but it was too much for Naesen and the chasing pair came round him in the final metres.
Though Belgian champion Gilbert looked to be gaining on his former teammate Van Avermaet, he ran out of road with Van Avermaet beating him by half a bike length to the line.
The win is Van Avermaet's first victory in the prestigious E3, and adds to his other one-day win this season at Omloop Het Nieuwsblad, leaving him as a definite favourite for the Tour of Flanders title next week.
How it happened
The race got underway in remarkably good weather with low wind and sunny skies, and that calmness transferred to the early stage of the race for the peloton as they let a six-man breakaway get up the road.
That group got over four minutes, but it never looked like succeeding as the race began to ramp up towards the final 80km when the Hellingen would make their mark on the race.
As they approached the series of cobbled hills, things got nervous in the main peloton and their were countless crashes, with Jack Bauer (Quick-Step) taking a particularly nasty spill around a corner.
Things really got going in the race on the Taaienberg climb however, with five-time winner Tom Boonen (Quick-Step) pushing on.
That move put a number of big name riders, including Team Sky's leaders Luke Rowe and Ian Stannard in trouble, and laid the foundations for Gilbert to make a decisive attack with 66km or so to go.
That attack eventually settled a leading group of six, including the three Belgians that would contest the finale along with Sep Vanmarke (Cannondale), Lukas Postlberger (Bora-Hansgrohe) and Luke Durbridge (Orica-Scott).
They worked together well and gathered a minute relatively quickly on the main group behind, as the likes of Katusha and Trek-Segafredo were unable to form any unity in the chase as they were consistently marked by BMC and Quick-Step riders working for Van Avermaet and Gilbert.
One of the pre-race favourites Sagan was in the group behind, but suffered a crash and bike damage, which saw him dropped out of contention almost instantly.
Meanwhile the front six reached the Oude Kwaremont together when things split up. Van Avermaet, Gilbert and Naesen pressed on and left the rest behind, with Durbridge and Postlberger trying but unable to recoup the gap after they'd crested the climb.
That breakaway trio then worked well to build up a minute themselves on the main bunch, and looked relatively content until they hit the final climb of the Tiegemberg where Gilbert tried to attack.
He briefly put Naesen in trouble but couldn't lose Van Avermaet. However it was soon all back together and they grew their gap to over two minutes, giving them plenty of time to battle it out in a sprint to the finish.
E3 Harelbeke 2017 (206.1km)
1. Greg Van Avermaet (Bel) BMC Racing Team 4-48-22
2. Philippe Gilbert (Bel) Quick-Step Floors
3. Oliver Naesen (Bel) AG2R La Mondiale, all same time
4. Luke Durbridge (Aus) Orica-Scott at 38s
5. Lukas Pöstlberger (Aut) Bora-Hansgrohe at 40s
6. Michael Valgren Andersen (Den) Astana Pro Team at 51s
7. Sonny Colbrelli (Ita) Bahrain-Merida at 53s
8. Tom Boonen (Bel) Quick-Step Floors
9. Dylan Van Baarle (Ned) Cannondale-Drapac
10. Alberto Bettiol (Ita) Cannondale-Drapac, all same time
Thank you for reading 20 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1