Lane keeping control technology can improve driving safety. But the direct control torque, caused by four in-wheel motors of an electric vehicle driven by four in-wheel motors (EV-DFIM), will affect the vehicle lateral stability. For solving this issue, a two-degree-of-freedom (2DOF) lateral dynamic model of an EV-DFIM lane keeping system is constructed to obtain the lateral stability control state equations. Then a homogeneous domination-based state observer and output feedback controller are designed to improve the vehicle lateral stability and balance when the lane keeping system is working. The Lyapunov method is used to prove that the designed homogeneous domination-based output feedback controller can globally asymptotically stabilize the system. Then, a direct yaw moment strategy is presented based on the optimal allocation algorithm with the lowest utilization rate of the tire to allocate the desired torques for every inwheel motor. Finally, numerical simulation and HIL simulation are carried out to verify that the proposed lateral stability control method based on homogeneous domination theory for the EV-DFIM lane keeping system has a good control effect and robustness.