We report photoluminescence and x-ray-diffraction studies on Sm-doped yttrium aluminum garnet (YAG) to ultrahigh pressures of 338 GPa in a diamond-anvil cell at room temperature. Photoluminescence spectra from Sm:YAG could be clearly identified with increasing pressures to 304 GPa. The rapidly shifting fluorescence from diamond anvil obscures the Sm:YAG emission spectra above 300 GPa. We provide the shift of the Y4 emission band of Sm:YAG to 304 GPa and give its pressure coefficients as referenced to the ruby standard to 180 GPa and platinum standard to 304 GPa. We present possible structural disorder mechanisms in Sm:YAG above 100 GPa which give rise to the line broadening and changes in intensities of various photoluminescence bands. The application of Sm:YAG as an optical pressure sensor in the ultrahigh-pressure regime is also discussed. © 1996 American Institute of Physics.