The Deceuninck-QuickStep rider completed the 257km course, which started in Compiegne, in a time of 5:58:04.
Nils Politt (Katusha-Alpecin) placed second, with Yves Lampaert (Deceuninck-QuickStep) third.
Gilbert has also won the Tour of Lombardy, Liege-Bastogne-Liege and Tour of Flanders monuments.
“It’s hard to believe it. I’m happy. I still have this dream of winning all five monuments. It’s a bit of a crazy dream that has inspired me for ten years and little by little I’m getting closer to it. I feel great pride today.”
The first half of the race saw numerous riders crash out or suffer punctures.
The first of these were Jasper Philipsen (UAE Team Emirates) and Julien Vermote (Dimension Data) in the peloton. They were fortunately unhurt and quickly remounted.
With 144km remaining, Alexander Kristoff (UAE Team Emirates) and Andre Greipel (Arkéa-Samsic) suffered punctures in the main peloton.
This was followed by a puncture for Matteo Trentin (Mitchelton-Scott) and Michaël van Staeyen (Roompot-Charles) in the break.
At 131km to the finish Taco van der Hoorn (Jumbo-Visma) crashed heavily in the left-hand gutter as the bunch travelled through sector 24. He ended up face down in the verge and was ultimately forced to abandon the race.
Iljo Keisse (Deceuninck-QuickStep) was also involved in a heavy crash and had to leave the race after riding into a traffic island.
With 72km to the finish Tiesj Benoot (Lotto-Soudal) also had to say goodbye to the race after crashing into a Jumbo-Visma car as he chased back from a mechanical.
After sector 12 at Bersees, Gilbert, 36, was alone in front.
He had a 15-second gap to defending champion Peter Sagan (Bora-Hansgrohe), Wout van Aert (Jumbo-Visma), Sep Vanmarcke (EF Education First), Yves Lampaert (Deceuninck-QuickStep) and Nils Politt (Katusha-Alpecin). The peloton was a further 22 seconds back.
Sagan then accelerated and caught Gilbert. Politt, Van Aert, Vanmarcke, Christophe Laporte (Cofidis), Lampaert and Marc Sarreau (Groupama–FDJ) followed suit.
The eight led the race onto the five-star sector at Mons-en-Pevele.
With 45km remaining after sector 11 at Mons-en-Pevele, Lampaert, Gilbert, Sagan, Politt, Van Aert and Vanmarcke were in front with a 35-second lead over the peloton.
Lampaert, Vanmarcke, Gilbert, Sagan and Politt were up front with 18km remaining as they left sector 5. Van Aert trailed by 20 seconds.
Sagan then led Gilbert off the Carrefour de l’Arbre, with Politt and Vanmarcke behind.
With under 10km to go, two sectors of cobbles remained, which were the 1.4km sector to Hem with 7.5km to the finish and a short stretch with 1.5km remaining in Roubaix.
In the final 5km Politt and Gilbert had a 45-second gap to Lampaert, who had dropped Sagan.
The route featured 29 cobbled sectors for a total of 54.4km of paving.