Compton reached lunch on day three on 57 not out in his side's 163 for four, a lead of 411.
Resuming on 46 for one in their second innings, Chris Wright struck early to remove Jack Leach for four but Alviro Petersen and Compton quickly had the hosts back on top. The South African, who made 136 in the first innings, went for 43 to Chris Woakes to end a partnership of 68, while Woakes also did for James Hildreth (five).
Derbyshire were desperately trying to save their match against Nottinghamshire at Derby, with rain on the final day helping their cause.
The hosts were 227 for eight after resuming on 143 for five - a lead of 40 - Dan Redfern top-scoring with 61.
Joe Root hit an unbeaten half-century to give Yorkshire hope of salvaging a draw at Durham.
Yorkshire, set an imposing victory target of 336 runs, were 121 for three on the final day, Root not out on 62.
Surrey fought back against Sussex as they eyed a draw at The Oval.
The hosts were 189 for three in their second innings, a lead of 14, thanks to fifties from Graeme Smith (67) and Gary Wilson (60).
Vikram Solanki took up the baton and was 42 not out.
- Sports & Recreation
- Chris Woakes