Sensitivity is an important performance index for evaluating surface plasmon resonance (SPR) biosensors. Sensitivity enhancement has always been a hot topic. It is found that the different refractive indices of samples require different combinations of prism and metal film for better sensitivity. Furthermore, the sensitivity can be enhanced by coating two-dimensional (2D) materials with appropriate layers on the metal film. At this time, it is necessary to choose the best film configuration to enhance sensitivity. With the emergence of more and more 2D materials, selecting the best configuration manually is becoming more complicated. Compared with the traditional manual method of selecting materials and layers, this paper proposes an optimization method based on a genetic algorithm to quickly and effectively find the optimal film configuration that enhances sensitivity. By using this method, not only can the optimal number of layers of 2D materials be determined quickly, but also the optimal configuration can be conveniently found when many materials are available. The maximum sensitivity can reach 400°/RIU after optimization. The method provided application value for the relevant researchers seeking to enhance sensitivity.