Viljoen played for Lions in domestic cricket and made one Test match appearance for the South Africa national team.
Viljoen was called up to the South African squad for the first time on the last day of 2015 as cover for Kyle Abbott.
[6] He made his County Championship debut on 23 August against Gloucestershire at Bristol, taking five wickets on the first day of the match.
[11][12] In July 2019, he was selected to play for the Rotterdam Rhinos in the inaugural edition of the Euro T20 Slam cricket tournament.
[18] In December 2019, he married Rhemi Rynners, the sister of South African international cricketer Faf du Plessis.