Quantum annealing is a promising method for solving combinational optimization problems and performing quantum chemical calculations. The main sources of errors in quantum annealing are the effects of decoherence and non- adiabatic transition. We propose a method for suppressing both these effects using inhomogeneous twist operators corresponding to the twist angles of transverse fields applied to qubits. Furthermore, we adopt variational methods to determine the optimal inhomogeneous twist operator for minimizing the energy of the state after quantum annealing. Our approach is useful for increasing the energy gap and/or making the quantum states robust against decoherence during quantum annealing. In summary, our results can pave the way to a new approach for realizing practical quantum annealing.