Pulse tube cryocoolers (PTCs) have wide applications such as space and military equipment, cooling superconducting coils, magnetic resonance imaging, cryopumps, etc. In a cryocooler, the regenerator plays a vital role to achieve low temperature by periodically storing and discharging refrigeration produced at the pulse tube cold end. This paper presents the optimization of the regenerator as a layered pattern using open-source software, REGEN 3.3 wherein multiple sizes of Stainless Steel (SS) mesh are used as regenerator material. A rigorous parametric study is conducted having uniform regenerator mesh size throughout the regenerator space as well as with layered configuration of different sizes of SS wire mesh as regenerator material. Parameters such as operating frequency, mass flow rate, and phase angle are also varied to analyze the Coefficient of Performance (COP) of the PTC. To optimize the multi-layer regenerator, an algorithm is provided, and based on the outcome of the optimization process, it is recommended to use the multi-layer configuration of SS wire mesh that provided significantly better performance as compared to the use of a uniform regenerator matrix material throughout the regenerator space. Additionally, it is also found through this study that there exists an optimum multi-layer combination of the regenerator for any configuration of the PTC that can be identified using the algorithmic procedure followed in this paper. The optimized layer patterns for the PTC are also reported in the paper. By the use of a 2-layer regenerator, COP increased by up to 10% over the single material regenerator. Whereas with a multi-layer regenerator, COP has increased by 9.86% to 5.21%. The algorithmic procedure followed in this paper can be conveniently used to optimize the layered pattern of the regenerator of a low-frequency as well as high-frequency PTC.