Regrowth steps in the fabrication of optoelectronic devices often require simultaneous preservation of InP, InGaAs, and InGaAsP during the initial heat-up before growth. In addition, if a grating is present on the wafer surface, it is necessary to prevent mass transport from eliminating it. We report on the use of As4 and P4 vapors to preserve gratings in InP and InGaAsP and also simultaneously preserve InP, InGaAs, and InGaAsP. Thermodynamic calculations are used to show that at 625-degrees-C InP and InGaAs are stable in As4 and P4 but not in AsH3 and PH3, respectively. The preservation technique developed in this study was used to fabricate high performance multiple quantum well planar buried heterostructure lasers and travelling wave amplifiers.