Protecting quantum states from the decohering effects of the environment is of great importance for the development of quantum computation devices and quantum simulators. Here, we introduce a continuous dynamical decoupling protocol that enables us to protect the entangling gate operation between two qubits from the environmental noise. We present a simple model that involves two qubits which interact with each other with a strength that depends on their mutual distance and generates the entanglement among them, as well as in contact with an environment. The nature of the environment, that is, whether it acts as an individual or common bath to the qubits, is also controlled by the effective distance of qubits. Our results indicate that the introduced continuous dynamical decoupling scheme works well in protecting the entangling operation. Furthermore, under certain circumstances, the dynamics of the qubits naturally led them into a decoherence-free subspace which can be used complimentary to the continuous dynamical decoupling.