Mobile sensor networks (MSNs) are utilized in many sensing applications that require both target seeking and tracking capabilities. Dynamics of mobile agents and the interactions among them introduce new challenges in designing robust cooperative control mechanisms. In this paper, a distributed semiflocking algorithm inspired by Temnothorax albipennis migration model is proposed to address the above issues. Mobile agents under the control of the proposed semiflocking algorithm are capable of detecting targets faster and tracking them with lower energy consumption when compared with existing MSN motion control algorithms. Furthermore, the proposed semiflocking algorithm can operate energy-efficiently on both flat and uneven terrains. Simulation results demonstrate that the proposed semiflocking algorithm can provide promising performances in target seeking and tracking applications of MSNs.