Vallie’s 117 came after the Cobras had suffered a mini-collapse, and along with Dane Vilas’ unbeaten half-century, helped them go to stumps on 388/6 in response to the Knights’ 570/5 declared.
With Corne Dry picking up a couple of wickets early in the day and Michael Erlank dismissing night watchman, Mthokozisi Shezi, the Cobras found themselves in a spot of bother at 188/4.
However, Vallie dug in and shared stands of 71 with Justin Ontong, who made 37, and then 108 with Vilas to make the home side favourites to avoid defeat in the match.
The Cobras resumed on 116/1 at the start of the day, but lost Richard Levi for 81 in the fourth over and then saw Omphile Ramela depart for a duck two overs later as Dry (3 for 68) made quick inroads.
Shezi more than did his job as nightwatchman by facing 149 deliveries for his 18, frustrating the Knights bowlers on another hot day in Paarl before he was caught behind off the bowling of Erlank.
That gave the Knights some hope of rattling through the Cobras and forcing a result, but Vallie dug in with a patient 232-ball knock that was in direct contrast to some of the more cavalier batting seen in the Knights’ innings.
Werner Coetsee made the only two breakthroughs in the second half of the day, bowling Ontong and then trapping Vallie lbw before finishing the day with figures of 2-71.
Vilas reached stumps unbeaten on 64, while Justin Kemp was 11 not out as the Cobras trailed by 182.