France will play England to decide who tops Pool C on Saturday after they finally subdued a battling Tonga.
France put in a characteristically fitful display - racing into a 17-point lead before being reeled in, then rallying before a late Tonga try set up a frantic finale.
However, Damian Penaud reclaimed Camille Lopez's restart to end the underdogs' hopes of snatching a win.
Pool C's winners will face the runners-up in Pool D in the last eight.
Australia look the most likely to finish second in Pool D, while Wales will top that group if they can negotiate matches against Uruguay and Georgia.
France make it three from three
France, with a third different half-back combination in as many matches, started the game at a canter as powerful centre Virimi Vakatawa went over from Alivereti Raka's one-handed pass.
When scrum-half Baptiste Serin spotted a unmarked Raka and the chance to tap and go for a second score, Jacques Brunel's side were 17-0 up after 35 minutes.
But, just as in their opening match against Argentina - when they allowed the Pumas back in the match from 20-3 down - France's concentration wavered.
Newcastle's Sonatane Takulua dived over from close range just before the break as Tonga's forwards wrestled their way into the ascendancy.
France full-back Maxime Medard paid the price for allowing the ball to bounce early in the second half as Malietoa Hingano pounced to power over.
With their advantage shaved down to three points, the sense that a repeat of Tonga's upset victory in the 2011 pool stages may be brewing stung France back into life.
They tightened up their play and fly-half Romain Ntamack landed two penalty goals to put his side 23-14 in front.
Penaud dived over to seemingly put the game beyond doubt, but that was to be more drama as referee Nic Berry - belatedly, but correctly - ruled out that score for a knock-on by Medard, and then Tonga flanker Zane Kapeli claimed a cross-field kick and dotted down.
Replacement Latiume Fosita slotted the conversion putting Tonga within two points as they prepared to receive kick-off with less than a minute to go.
But Penaud tapped the kick-off back to a team-mate and France booted into touch to end the game.
A threat to England?
Despite only scraping past an opponent his own side saw off 35-3 in the tournament opener, England head coach Eddie Jones will have seen how France can threaten his team.
Raka and Penaud both showed their quality as strike runners capable of undoing a defence with moments of individual brilliance, while scrum-half Antoine Dupont was lively around the edge of the breakdown after he came on with 25 minutes to go.
The prospect of playing their Six Nations rivals might also bring the consistency, concentration and 80-minute performances France have not yet put in at the tournament.
However, with Pool C's runners-up set on a path that would see them avoid tournament favourites New Zealand until a potential final, they may also feel the meeting with England is one they can afford to lose.
Match stats
Teams
France: Medard; Penaud, Vakatawa, Guitoune, Raka; Ntamack, Serin; Poirot, Chat, Slimani, Gabrillagues, Vahaamahina, Lauret, Ollivon, Alldritt.
Replacements: Guirado, Baille, Setiano, Le Roux, Camara, Dupont, Lopez, Barassi.
Tonga: Veainu, Vuna, Hingano, Piutau, Halaifonua; Faiva, Takulua; Fisi'ihoi, Ngauamo, Fia; Lousi, Fifita, Kalamafoni, Kapeli, Vaipulu.
Replacements: Sakalia, Fifita, Halanukonuka, Mafi, Manu, Fukofuka, Fosita, Pakalani.