I develop a theory of optimal capital structure and endogenous ownership for family firms based on a trade-off between maintaining family control and alleviating moral hazard. Depending on the severity of the agency costs of free cash flow, the model generates wide dispersion in leverage ratios, both within the cross-section and across different investor protection regimes. Because the family owner values amenity potential, in the absence of severe agency problems she will prefer lower optimal leverage in order to reduce her personal bankruptcy cost. If the amenity potential is sufficiently large, family firms in our model may become optimally under-levered, consistent with recent findings by Strebulaev and Yang (2013). The results are robust to the assumption of risk aversion when leverage provides additional diversification benefits to the family owner who faces an incomplete market. In contrast, family firms with severe agency costs of free cash flow use more leverage in order to commit not to expropriate minority shareholders, thus securing higher proceeds from the sale of equity. Overall, the model generalizes the presence of concentrated owners with control motivations into the trade-off theory of capital structure in a manner consistent with theoretical foundations of agency.