It's been argued that the epilogue of Crime and Punishment is an unnecessary "happily ever after" ending to a book that could have been better ended with Raskolnikov's final decision to confess his crime. On the contrary, I think the epilogue deepens the book and makes it more stable, while not taking away too much of the story's drama.
The entire book, up to this point, has been told from the perspective of Raskolnikov. In contrast, the first half of the epilogue is functionally as well as nominally in the third person. This gives us a different, probably more objective view of Raskolnikov, while allowing more screen time for some of the other characters. The epilogue thus gives you a sense of perspective on the whole story. And since its pace is slower that the book as a whole, you get the chance to look back on the story and reflect before putting the book down.
Pulcheria, Raskolnikov's mother, suffers greatly when he is imprisoned. She is never told about his misdeed, though it seems she knows more than she lets on. Eventually she sickens (in a manner much like Raskolnikov's sickness) and dies. Aside from considerably deepening what we know about Pulcheria, this addition shows us that Raskolnikov has managed to kill not only the pawnbroker and Lizaveta but also his own mother, with all the implications that brings. Also, at least in my mind, Dunia is conspicuously absent from the story of her mother Pulcheria's death, possibly forcing us to revise her image as well.
The epilogue also makes clear that the Svidrigailov/Sonia battle does not end with Raskolnikov's confession. Svidrigailov's example remains vivid after the confession, though Svidrigailov himself is dead. Perhaps as a result, while in jail Raskolnikov withdraws himself and becomes sick, much as he did in the period leading up to his crime. Obviously Raskolnikov has not managed to clear everything up with one ten-second statement of conscience, after which he somehow lives or dies happily ever after. Rather, his repentance is ongoing, subject to reversals, and is unfinished even at the end of the epilogue.
Thus, while the epilogue is certainly more "optimistic", I think the story feels much more grounded in the real world and in our moral experience once it gets the epilogue's open ending. Instead of finishing with one dramatic action, the epilogue instead hints at the possibility of extensive future growth.