The efficiency of a nonlinear optical process is proportional to the interaction time. We report a scheme of all-optical switching based on two motionless light pulses via the effect of electromagnetically induced transparency. One pulse was stopped as the stationary light pulse (SLP) and the other was stopped as stored light. The time of their interaction via the medium can be prolonged and, hence, the optical nonlinearity is greatly enhanced. Using a large optical density (OD) of 190, we achieved a very long interaction time of 6.9 μs. This can be analogous to the scheme of trapping light pulses by an optical cavity with a Q factor of 8×109. With the approach of using moving light pulses in the best situation, a switch can only be activated at 2 photons per atomic absorption cross section. With the approach of employing a SLP and a stored light pulse, a switch at only 0.56 photons was achieved and the efficiency is significantly improved. Moreover, the simulation results are in good agreement with the experimental data and show that the efficiency can be further improved by increasing the OD of the medium. Our work advances the technology in quantum information manipulation utilizing photons.