In this paper, a Hamilton-Jacobi-Bellman (HJB) equation based optimal control algorithm for robust controller design is proposed for a nonlinear system. Utilising the Lyapunov direct method, the controller is shown to be optimal with respect to a cost functional, which includes penalty on the control effort, the maximum bound on system uncertainty and cross-coupling between system state and control. The controllers are continuous and require the knowledge of the upper bound of system uncertainty. In the present algorithm, neural network is used to approximate value function to find approximate solution of HJB equation using least squares method. Proposed algorithm has been applied on a nonlinear system with matched uncertainties. It is also applied to the system having uncertainties in input matrix. Results are validated through simulation studies. Copyright © 2009, Inderscience Publishers.