Afolami was the Conservative Party candidate for Lewisham Deptford at the 2015 general election, where he finished in second place with 7,056 votes. Afolami voted "Remain" in the 2016 referendum on EU membership. He was selected as the Conservative candidate for Hitchin and Harpenden constituency in 2017 following the announcement that the sitting Conservative MP, Peter Lilley, was to stand down.