In cloud computing, task scheduling and resource allocation are the two core issues of the IaaS layer. Efficient task scheduling algorithm can improve the matching efficiency between tasks and resources. In this paper, an enhanced heterogeneous earliest finish time based on rule (EHEFT-R) task scheduling algorithm is proposed to optimize task execution efficiency, quality of service (QoS) and energy consumption. In EHEFT-R, ordering rules based on priority constraints are used to optimize the quality of the initial solution, and the enhanced heterogeneous earliest finish time (HEFT) algorithm is used to ensure the global performance of the solution space. Simulation experiments verify the effectiveness and superiority of EHEFT-R.