An accurate prediction of residual burned gas within the combustion chamber is important to quantify for development of modern engines, especially so for those with internally recycled burned gases and HCCI operations. A wall-guided GDI engine has been fitted with an in-cylinder sampling probe attached to a fast response NDIR analyser to measure in-situ the cycle-by-cycle trapped residual gas. The results have been compared with a model which predicts the trapped residual gas fraction based on heat release rate calculated from the cylinder pressure data and other factors. The inlet and exhaust valve timings were varied to produce a range of Residual Gas Fraction (RGF) conditions and the results were compared between the actual measured CO2 values and those predicted by the model, which shows that the RGF value derived from the exhaust gas temperature and pressure measurement at EVC is consistently overestimated by 5% over those based on the CO2 concentrations. The implications for engines with internally recycled burned gases and HCCI combustion development were considered. It is shown that there is an optimum valve overlap period for a given operating condition that produces highest indicated thermal efficiency and optimised combustion phasing. In addition, the minimum residual gas concentration should be employed for the least pumping loss during the recompression process when the negative valve overlap method is used to achieve CAI/HCCI combustion for a given engine output.