We explore the effects of banking regulation on financial stability and macroeconomic dynamics in an agent-based computational model. In particular, we study the minimum level of capital and the lending concentration towards a single counterpart. We show that an overly tight regulation is dangerous because it reduces credit availability. By contrast, overly loose constraints, associated with a high payout ratio, increase financial fragility that, in turn, damage the real economy. Simulation results support the introduction of regulatory rules aimed at assuring an adequate capitalization of banks, such as the Capital Conservation Buffer (Basel III reform).