We propose a simple model of borrower optimism in competitive lending markets with asymmetric information. Borrowers in our model engage in self-deception to arrive at a belief that optimally trades off the anticipatory utility benefits and material costs of optimism. Lenders' contract design shapes these benefits and costs. The model yields three key results. First, the borrower's motivated cognition increases her material welfare, regardless of whether or not she ends up being optimistic in equilibrium. Our model thus helps explain why wishful thinking is not driven out of markets. Second, in line with empirical evidence, a low cost of lending and a booming economy lead to optimism and the widespread collateralization of loans. Third, equilibrium collateral requirements may be inefficiently high.