This paper presents a dynamic model of the firm with risk-free debt contracts, investment irreversibility, and debt restructuring costs. The model fits several stylized facts of corporate finance and asset pricing: First, book leverage is constant across different book-to-market portfolios, whereas market leverage differs significantly. Second, changes in market leverage are mainly caused by changes in stock prices rather than by changes in debt. Third, when the model is calibrated to fit the cross-sectional distribution of book-to-market ratios, it explains the return differences across different firms. The model also shows that investment irreversibility alone cannot generate the cross-sectional patterns observed in stock returns and that leverage is the main source of the value premium.