We estimate the effect of domestic outsourcing on labor markets using Brazil's 1993 legalization, which sharply increased the outsourcing of security guards. Using a triple-differences design that leverages North-South variation in pre-legalization court permissiveness and compares guards to less affected occupations, we find that outsourcing legalization persistently increased total employment of security guards in more restrictive regions by 8-15% and reduced their average age by two years. In addition, while ensuing layoffs reallocated incumbent security guards to different occupations in lower-wage firms, the average wage of security guards did not fall in more restrictive regions, with some specifications suggesting a small positive effect. This is consistent with a legalization-driven increase in demand for security guards. A simple model implies that the market-level efficiency gains from outsourcing legalization more than offset the earnings losses of incumbent workers.