This paper deals with the optimal design for a twin die stacked package. Firstly, the numerical model is built up in terms of a three-dimensional slice model along the diagonal direction of the package. The material behavior of the solder balls is a consequence of the viscoplastic property which can be described by the Anand's model. Secondly, the Darveaux model is applied to predict the solder ball reliability of the stacked die package under a cyclic temperature loading. Since simulation analysis found an obvious relation is found between the fatigue life of the solder ball and the distribution of the accumulated strain energy density (SED) on the critical solder ball of the package through the simulation analysis, the average value of the strain energy density for all solder balls is adopted as the optimization indicator of reliability. With such a viewpoint, the critical solder ball position can be ignored, and accordingly an efficient analysis can be obtained. Finally, the Box-Behnken regression model is adopted to construct all the experiments. Each experiment analyzes the reliability of the package under varying parameters. Subsequently, the pattern search algorithm is applied to search for optimal factors.Through optimal analysis with the fatigue reliability indicator of an average SED, the fatigue life is found to be 59 lower than that of the original design. The fatigue life had clearly improved and the lowest ball fatigue life is found to be 2.859 times longer than the original one.