The photosphere is the layer of the star from which light propagates, i.e., plasma/gas from which photons directly leave the star. Regarding the Sun, it is what we see as "the Sun". It is very thin compared to the size of the star (in the case of the Sun, thicknesses in the 100-500 km range are cited, presumably depending upon exactly how the photosphere is defined) and sometimes the term is used to represent a specific level (of negligible thickness) rather than a finite layer. A stellar atmosphere is defined to be the photosphere and layers above it, such as the chromosphere.
Criteria for the depth and thickness of the photosphere is confounded by the fact that the escape of photons is probabilistic, i.e., the further down, the fewer photons escape, but as you go deeper, the probability of escape doesn't end at some point, but grows ever closer to zero. Another confounding fact is that the depth depends upon the EMR's wavelength: at some wavelengths, this layer of the star is more transparent than at others. However, a thin-but-finite layer from which the vast majority of the photons escape from can be defined. In the case of the Sun, there is a narrow layer where the transparency rises significantly, where the ionization shifts balance and above which photons are distinctly less likely to be absorbed or scattered.
A commonly-used criteria for the level of the photosphere (as a "surface" with no thickness) is an optical depth of 2/3, which is roughly the median depth from which photons leaving the star came from, given that some leave at angles from vertical and must pass through more of the partially-opaque material. The temperature (which is increasing by depth) at the 2/3 optical depth roughly matches the star's effective temperature, according to analysis using the local thermodynamic equilibrium, the Eddington approximation and plane-parallel atmosphere simplifications.
When considered as a finite layer, for example, for the purposes of a specific model, a specific criteria regarding the depth is likely to be adopted, e.g., down to an optical depth of 1.