The Team Sky rider finished third in the individual time trial behind nearest rival Tom Dumoulin but still leads the Dutchman by one minute and 51 seconds.
Dumoulin beat defending champion Chris Froome by one second to win stage 20, a race against the clock from Saint-Pee-Sur-Nivelle to Espelette spanning 31km.
Tour convention dictates that the race leader is never challenged on the final stage, so the Welshman only needs to reach the finish in Paris on Sunday to win.
Sprinters will fight it out for glory on the Champs-Elysees before the tour's overall winner is honoured.
Thomas will also become the third Briton to win the Tour de France, after Froome and Bradley Wiggins.