In this paper, we presented a framework for the trajectory optimization of the 5-link Biped Robot using the Beetle Antennae Search (BAS) algorithm. The biped robot is highly nonlinear and has complex dynamical modeling. It is challenging to obtain a closed-form solution for the Robot. The robot modeling has two stages, i.e., the optimal trajectory generation and the robust control of a robot. The conventional methodologies treat both problems separately and are computationally expensive. This paper presented an optimization problem that combines the trajectory generation and control problem of a 5-link biped robot. We employed Beetle Antennae Search (BAS) for the problem's online-solution, an intelligent online optimization approach. BAS is a single-particle searching algorithm, which makes it robust, computationally, and memory-wise efficient. We applied BAS on two non-linear systems, i.e., inverted pendulum and 5-link biped robot, and convincing results are obtained with BAS.