Joe Denly missed out on a century but put England in a commanding position at stumps on day three of the fifth Test.