This paper proposes a new Dynamic Stochastic General Equilibrium (DSGE) model with credit frictions and a banking sector, which endogenizes loan-to-value (LTV) ratios of households and banks by expressing them as a function of systemic and idiosyncratic proxies for risk. Moreover, the model features endogenous balance sheet choices and a novel formulation of the targeted leverage ratio, in which assets are risk-weighted by risk-sensitivity measures. The results highlighted in this paper are important along two dimensions. First of all, the presence of endogenous LTV ratios exacerbates the procyclicality of lending conditions. Second, the model contributes to deeper understand the role of prudential regulatory frameworks in affecting business cycle fluctuations and in restoring macroeconomic and financial stability. The results suggest that when the economy is severely stressed by shocks originating in the financial sector, prudential regimes such as Basel II and Basel III are capable of downsizing substantially aggregate volatility, with Basel III found to be significantly more effective than Basel II.