Particle swarm optimizer (PSO) and mobile robot swarm are two typical swarm techniques. Many applications emerge separately along both of them while the similarity between them is rarely considered. When a solution space is a certain region in reality, a robot swarm can replace a particle swarm to explore the optimal solution by performing PSO. In this way, a mobile robot swarm should be able to efficiently explore an area just like the particle swarm and uninterruptedly work even under the shortage of robots or in the case of unexpected failure of robots. Furthermore, the moving distances of robots are highly constrained because energy and time can be costly. Inspired by such requirements, this article proposes a moving-distance-minimized PSO (MPSO) for a mobile robot swarm to minimize the total moving distance of its robots while performing optimization. The distances between the current robot positions and the particle ones in the next generation are utilized to derive paths for robots such that the total distance that robots move is minimized, hence minimizing the energy and time for a robot swarm to locate the optima. Experiments on 28 CEC2013 benchmark functions show the advantage of the proposed method over the standard PSO. By adopting the given algorithm, the moving distance can be reduced by more than 66% and the makespan can be reduced by nearly 70% while offering the same optimization effects.