The decline in the U.S. labor share is far from uniform across firms. While the aggregate labor share has declined, especially in manufacturing, retail, and wholesale, the labor share of a typical firm in these industries has risen. This paper studies the dynamics of the substitution of capital for labor at the firm level and its implications for market structure and labor shares. We introduce a model of firm dynamics where firms make costly upfront investments to adopt the capital-intensive technologies required to automate additional tasks. Following a decline in the price of capital, large firms automate more of their tasks and become more capital intensive; while the median firm continues to operate a more labor-intensive technology. In line with firm-level data, our model generates transitions in which the labor share of the median firm increases at the same time as the aggregate labor share declines. We use an extension of our model that allows for endogenous markups to study the role of rising competition and reallocation towards more productive and higher-markup firms as another driver of the decline in the labor share during 1982–2012. We provide a quantitative decomposition showing that reallocation played a minor role in explaining the decline in the labor share in U.S. manufacturing but an important role in retail and other sectors. The substitution of labor with cheaper capital in a widening range of tasks played a more dominant role in explaining the decline of the manufacturing labor share.