A two-dimensional detonation in H2–O2 system is simulated by a high-resolution code based on the fifth-order weighted essentially non-oscillatory (WENO) scheme in the spatial discretization and the 3th-order additive Runge–Kutta schemes in the time discretization, by using a detailed chemical model. The effect of a concentration gradient on cellular detonation is investigated. The results show that with the increase of the concentration gradient, the cell instability of detonation increases and gives rise to the oscillation of average detonation velocity. After a long time, for the case of the lower gradient the detonation can be sustained, with the multi-head mode and single-head mode alternating, while for the higher gradient it propagates with a single-head mode.