In a magnet with pancake windings, inserting a gap between the pancake windings can increase the central magnetic field. This paper shows the optimized length of each gap is able to maximize the central magnetic field. Inserting a gap also improves field uniformity because the pancake windings are spread across a wider area. A high temperature superconducting (HTS) magnet consisting of BSCCO-2223 pancake windings was chosen for the calculation model to show the effectiveness of the proposed method. The relation was used to determine the critical current, and an evolution strategy was adopted for the optimization of gap length. The results of calculations show that the critical current and the central magnetic field increased by 86.0% and 33.7%, respectively, for a magnet consisting of ten pancake windings.