In this research, a framework of acoustic analysis and shape optimization, based on isogeometric boundary element method (IGA-BEM), is proposed for three-dimensional doubly periodic multilayered structures. The study addresses a gap in the literature by focusing on the shape optimization of such structures, which has not been extensively explored previously. The interface between different acoustic media is an infinite doubly periodic surface, which can be constructed by an open non-uniform rational B-splines. A periodic IGA-BEM is developed for the sound field analysis of the doubly periodic multilayered structure, in which the Ewald method is used to accelerate the calculation of periodic Green function. Furthermore, the shape derivative of the doubly periodic multiple boundaries is derived by imposing boundary perturbation and using the adjoint variable method. The control points of the NURBS surfaces are defined as the shape design variables, and all shape sensitivities can be quickly calculated by discretizing the shape derivative formula. Finally, in according with shape sensitivities, the corresponding shape optimization problem is solved by the method of moving asymptotes, so that the optimized shape design can be obtained. A series of numerical examples validates the accuracy and applicability of the proposed approaches.