The photosphere is the layer of the star from which light propagates, i.e., plasma/gas from which photons directly leave the star. Often the term is used to represent a specific level (infinitely thin) rather than a finite layer. Beneath the photosphere, photons are generally captured by atoms before leaving the star. The photosphere is the lowest layer of the stellar atmosphere, which term also includes the layers above the photosphere, such as the chromosphere.
This is an inexact definition in that the depth from which no photons escape is not fixed: with increased depth, the probability of a photon's escape declines, nearing but never reaching zero. Also, the probability of escape depends upon the wavelength.
The generally used criteria for the level of the photosphere (as a "surface" with no thickness) is an optical depth of 2/3, roughly the median depth from which photon leaving the star came from. The temperature at that level matches the effective temperature, according to analysis using the local thermodynamic equilibrium, the Eddington approximation and plane-parallel atmosphere simplifications.
When considered as a finite layer, typical is to use the layer from that depth down to an optical depth of 1. In modeling, a more specific criteria may be specified.