In middle-income countries, the informal sector often accounts for a substantial fraction of the urban labor force. We develop a general equilibrium model with matching frictions in the urban labor market, the possibility of self-employment in the informal sector, and scope for rural–urban migration. We investigate the effects of labor market institutions, different types of growth, and company taxes on labor market outcomes and aggregate productivity. We quantify these effects by calibrating the model to data for Mexico, and show that matching frictions can lead to a large informal sector when formal sector workers have substantial bargaining power.