The 27-year-old Cook displayed immense concentration and skill to not only notch up his 21st Test century under pressure but also keep his team in the game as he steered England to 340 for five at close
Cook made a magnificent 168 in 505 minutes from 341 balls with 20 boundaries and still at the crease with Prior who was 84 not out when the play ended on the fourth day.
Earlier, England resumed their second innings at 111 for no loss with an uphill task of making further 219 runs to avoid the innings defeat.
But Cook and Nick Compton added just 12 runs when the latter departed for 37. Both scored 123 runs for the opening stand to give England a sound start.
However, England lost four more wickets for 76 runs before Prior joined Cook and both took the innings to 340 without further damage at stumps.
They added 141 runs for an triumphant sixth wicket partnership to get England a lead of ten runs with five wickets in hand. They still have a long way to bat for a draw as they have one full day left.