A novel algorithm to solve the target tracking and formation control problem in multi-agent systems is proposed in the present work, which combines centroidal Voronoi tessellations (CVT) with consensus strategy. The algorithm utilizes the connection information among robots to further reduce the system cost function on the basis of CVT configuration. The work load among robots can be averaged by the consensus strategy thus the tracking and formation task can be achieved. The method configures the robots on to local optimal solution which minimize the sensing error. Simulations validated the proposed approach. Comparison is drawn between the pure CVT algorithm and the method with consensus strategy.