Yates (Mitchelton-Scott) safely marked his nearest challenger Alejandro Valverde (Movistar), and now only two stages remain before Sunday’s processional finish in Madrid.
Enric Mas (Quick-Step Floors) remains in third place, one minute and 22 seconds behind Yates.
The 186.1 kilometres between Ejea de los Caballeros and Lleida produced a dramatic stage as Wallays (Lotto Soudal), Sven Erik Bystrom (UAE Team Emirates) and Jetse Bol (Burgos-BH) broke away inside the opening three kilometres.
It had been expected that the flat stage would suit the sprint specialists, but Wallays and Bystrom worked well together after dropping Bol late on.
The pair just had enough to hold off the fast-finishing Peter Sagan over the final 500 metres, with Belgium’s Wallays taking the stage win from Bystrom.
“Everybody was expecting a massive sprint,” said Wallays.
“But I had something in my mind to do something in this stage, and I knew if I was good I could surprise many riders.”
Yates will face a big test on today’s stage 19, which ends with the 17km climb of Rabassa.
Yates was in this position four months ago at the Giro d’Italia, leading a grand tour with two decisive stages to come.
And it was on the 19th stage that Chris Froome launched a daring attack that took the race victory away from Yates – an outcome he will be looking to avoid over the next 48 hours.