A direct optimization method for a broad class of three-dimensional aerodynamic shapes based on the approximation of the desired geometry by Bernstein-Bézier surfaces is developed. The high efficiency of the method is demonstrated by applying it to the design of an optimal supersonic section of an axisymmetric maximum-thrust de Laval nozzle. The method is also tested as applied to the design of a three-dimensional supersonic nozzle section in a dense multi-nozzle setup. In addition to three-dimensional supersonic nozzle sections with a circular throat, nozzles with a varying throat shape are considered. The results suggest that the method can be applied to various problems of 3D shape optimization.