We develop an equilibrium model of debt maturity choice of firms, in the presence of fixed issuance costs in primary debt markets, and an over-the-counter secondary debt market with search frictions. Liquidity in this market is related to the ratio of buyers to sellers, which is determined in equilibrium via the free entry of buyers. Short maturities improve the bargaining position of debtholders who sell in the secondary market and hence reduce the interest rate that firms need to offer on debt. Long maturities reduce re-issuance costs. The optimally chosen maturity trades off both considerations. Firms individually do not internalize that choosing a longer maturity increases the expected gains from trade in the secondary market, which attracts more buyers, and hence also facilitates the sale of debt issued by other firms. As a result, the laissez-faire equilibrium exhibits inefficiently short maturity choices. Empirical implications of the model include that issuance yields and bid-ask spreads should be increasing in maturity.