Four late wickets, including both centurions, allow Stokes’ men some breathing space on sweltering day