Minimizing the number of necessary two-qubit gates is an important task in quantum information processing. By introducing non-computational quantum states in auxiliary spaces, we construct effective circuits for the controlled-NOT (CNOT) gate and the n-control-qubit Toffoli gate with (2n-1) qubit-qudit gates and (2n-2) single-qudit gates. We propose the polarization CNOT and Toffoli gates based on the designed quantum circuits in linear optics by operating on the spatial-mode degree of freedom of photons. Our optical schemes can be achieved with a higher success probability and no extra auxiliary photons are needed.