SrTiO$_3$ thin films were used as a model system to study the effects of strain and epitaxial constraint on structural phase transitions of perovskite films. The basic phenomena revealed will apply to a variety of important structural transitions including the ferroelectric transition. Highly strained SrTiO$_3$ films were grown on different substrates, providing both compressive and tensile strain. The measured strain-temperature phase diagram is qualitatively consistent with theory, however the increase in the phase transition temperature is much larger than predicted. Due to the epitaxial strain and substrate clamping, the SrTiO$_3$ lattice is tetragonal at all temperatures. The phase transitions involve only changes in internal symmetry. The low temperature phase under tensile strain has a unique structure with orthorhombic $Cmcm$ space group but a tetragonal lattice, an interesting consequence of epitaxial constraint.