Over the past decades, developments and scientific breakthroughs in the field of robotics have shown the replacement of wheeled robots with legged robots, which are often inspired by the biological characteristics of legged animals. Many industries and urban‐based applications promote quadruped robots because of their dexterous ability to efficiently handle multiple tasks in the work-ing environment. Motivated from the recent works in the field of quadruped robots, this research aims to develop and investigate gaits for a 2 DoF mammal‐inspired quadruped robot that incorpo-rates 4 hip and 4 knee servo motors as its locomotion element. Forward and inverse kinematic techniques are used to determine the joint angle required for the locomotion and stability calculation are presented to determine the center of mass/center of gravity of the robot. Three types of gaits such as walk, trot, and pace are developed while keeping the center of mass inside the support polygon using a closed‐loop control system. To minimize errors and improve the performance of the robot due to its non‐linearity, a meta‐heuristic algorithm has been developed and addressed in this work. The fitness function is derived based on the Euclidean distance between the target and robot’s current position and kinematic equations are used to obtain the relation between joints and coordinates. Based on the literature, particle swarm optimization (PSO) was found to be a promising algorithm for this problem and is developed using Python’s ‘Pyswarms’ package. Experimental studies are carried out quantitatively to determine the convergence characteristics of the control algorithm and to investigate the distance traveled by the robot for different target positions and gaits. Comparison between experimental and theoretical results prove the efficiency of the pro-posed algorithm and stability of the robot during various gait movements.