This paper introduces optimal sliding mode control with a predefined upper bound of settling time (PUBST) for stabilizing uncertain nonlinear dynamical systems. Sufficient conditions for optimality are given, which involve a Lyapunov function that satisfies a certain differential inequality guaranteeing PUBST. Further, for guaranteeing optimality it also satisfies the Hamilton-Jacobi-Bellman equation. Moreover, an integral sliding mode control is integrated with the optimal PUBST control to make the system insensitive to the matched type of bounded perturbations. The validity of the proposed method is demonstrated with a practical example of a rigid body aircraft system. © 2022 IEEE.