The effect of electrical stimulation on neuronal membrane potential is frequency dependent. Low frequency electrical stimulation can evoke action potentials, whereas high frequency stimulation can inhibit action potential transmission. Optical stimulation of channelrhodopsin-2 (ChR2) expressed in neuronal membranes can also excite action potentials. However, it is unknown whether optical stimulation of ChR2-expressing neurons produces a transition from excitation to inhibition with increasing light pulse frequencies. Here we report optical inhibition of motor neuron and muscle activity in vivo in the cooled sciatic nerves of Thy1-ChR2-EYFP mice. We also demonstrate all-optical single-wavelength control of neuronal excitation and inhibition without co-expression of inhibitory and excitatory opsins. This all-optical system is free from stimulation-induced electrical artifacts and thus provides a new approach to investigate mechanisms of high frequency inhibition in neuronal circuits in vivo and in vitro.