Controlled auto-ignition (CAI) combustion, also known as homogeneous charge compression ignition (HCCI) can be achieved by trapping residuals with early exhaust valve closure in both port and direct fuel injection four-stroke gasoline engines. A multi-cycle three-dimensional engine simulation program has been developed and applied to study the effect of injection on in-cylinder mixing and CAI combustion. The full engine cycle simulation, including complete gas exchange and combustion processes, was carried out over several cycles in order to obtain the stable cycle for analysis. The combustion models used in the present study are based on the Shell auto-ignition model and the characteristic-time combustion model, both of which have been modified to take the high level of residual gas into consideration. A liquid sheet break-up spray model was used for the droplet break-up processes. The analyses show that the injection timing plays an important role in affecting the in-cylinder air/fuel mixing and mixture temperature, which in turn affects the CAI combustion and engine performance. In comparison with the port fuel injection case, an early direct injection at exhaust valve closure can lead to higher load and lower fuel consumption.