Microfinance banks use group-based lending contracts to strengthen borrowers' incentives for diligence, but the contracts are vulnerable to free-riding and collusion. We systematically unpack microfinance mechanisms through ten experimental games played in an experimental economics laboratory in urban Peru. Risk-taking broadly conforms to theoretical predictions, with dynamic incentives strongly reducing risk-taking even without group-based mechanisms. Group lending increases risk-taking, especially for risk-averse borrowers, but this is moderated when borrowers form their own groups. Group contracts benefit borrowers by creating implicit insurance against investment losses, but the costs are borne by other borrowers, especially the most risk averse.