Virtualization creates virtual OS, platform, network devices, storage, software, and hardware devices in cloud computing. Moreover, Virtual Machine (VM) technology has essential building blocks like cluster systems and data centre. The advancement is due to migrating, consolidating and isolating workloads. The VM migration seeks to enhance the security, performance, manageability and fault tolerance systems. In a virtual CC environment, some sets of tasks from various users are scheduled over the VMs, and load balancing turns out to be a crucial issue in achieving security and energy efficiency. Therefore, a novel optimization algorithm is initiated to resolve these issues and attain superior balancing with the influence of external resources. The Conditional Random Field-based Moth Algorithm (CRF-MA) considers the multi-objective functions by handling metrics like security, energy consumption, CPU utilization, makespan, migration, and resource cost. The performance of the CRF-MA is examined by determining the energy consumption, SLA violation, solution size and migration number. The simulation is done in CloudSim, and the proposed CRF-MA gives a better trade-off than other approaches.