In this paper, a Hamilton-Jacobi-Bellman (HJB) equation based optimal control algorithm is proposed for a bilinear system. Utilizing the Lyapunov direct method, the controller is shown to be optimal with respect to a cost functional, which includes penalty on the control effort and the system states. In the proposed algorithm, Neural Network (NN) is used to And approximate solution of HJB equation using least squares method. Proposed algorithm has been applied on bilinear systems. Necessary theoretical and simulation results are presented to validate proposed algorithm. © 2008 IEEE.