Residual gas plays a crucial role in the combustion process of SI engines. It acts as a diluent and has a huge impact on pollutant emissions (NOx and CO emissions), engine efficiency and tendency to knock. Therefore, characterizing the residual gas fraction is an essential task for engine modelling and calibration purposes. Thus, an in-cylinder sampling technique has been developed on a spark ignition VVT engine to measure residual gas fraction. Two gas sampling valves were flush mounted to the combustion chamber walls; they are located between the 2 intake valves and between intake and exhaust valves respectively. In-cylinder gas was sampled during the compression stroke and stored in a sampling bag using a vacuum pump. The process was repeated during a large number of engine cycles in order to get a sufficient volume of gas which was then characterized with a standard gas analyzer. This paper describes in details the sampling technique and proposes a methodology allowing the evaluation of the residual gas fraction. For this purpose, five kinds of tests were undertaken. First, tests were achieved to reach different volumes of gas in the sampling bag in order to study gas analyzer response and establish the minimum volume required. The system uncertainty and the engine repeatability were tested to determine the maximum sampling error. Then, a short sampling interval was tested throughout the compression stroke using the first sampling valve to identify the temporal disparity in the chamber and determine the maximum permissible crank angle interval for a stable measurement. Several samplings were then performed for different engine operating points to compare the results obtained with the two sampling valves and study spatial inhomogeneity. Results were compared to misfiring samples from the end of the expansion stroke. An accurate and rather simple estimation of the residual fraction was then provided.