It greatly simplifies the analysis because an inifinite potential outside the box ensures that your wavefunction is zero anywhere outside the box. If you solve the particle in a box using a finite potential outside of the box, you see tunneling occur, that is you have a small probablility that your particle lies outside of the box.
So in short, an inifinite potential outside of the box ensures a zero probability of being outside of the box. The boundary conditions (that the wavefunction is zero at the edges of the box) are a consequence of this potential.