Two cornerstones of empirical and policy analysis of firms, in macro, labor and industrial organization, are the determinants of the firm size distribution and the determinants of sorting between workers and firms. We propose a unifying theory of production where management resolves a tradeoff between hiring more versus better workers. The span of control or size is therefore intimately intertwined with the sorting pattern. We provide a condition for sorting that captures this tradeoff between the quantity and quality of workers and that generalizes Becker's sorting condition. A system of differential equations determines the equilibrium allocation, the firm size, and wages, and allows us to characterize the allocation of the quality and quantity of labor to firms of different productivity. We show that our model nests a large number of widely used existing models. We also augment the model to incorporate labor market frictions in the presence of sorting with large firms.