We investigate the energy loss process produced by damping the boundary atoms of a chain of classical anharmonic oscillators. Time-dependent perturbation theory allows us to obtain an explicit solution of the harmonic problem: even in such a simple system nontrivial features emerge from the interplay of the different decay rates of Fourier modes. In particular, a crossover from an exponential to an inverse-square-root law occurs on a timescale proportional to the system size N. A further crossover back to an exponential law is observed only at much longer times (of the order N3). In the nonlinear chain, the relaxation process is initially equivalent to the harmonic case over a wide time span, as illustrated by simulations of the ß Fermi-Pasta-Ulam model. The distinctive feature is that the second crossover is not observed due to the spontaneous appearance of breathers, i.e. space-localized time-periodic solutions, that keep a finite residual energy in the lattice. We discuss the mechanism yielding such solutions and also explain why it crucially depends on the boundary conditions.