In situations where scarce resources are being allocated, peer review ensures that those decisions are made by people who share a set of values about what counts as knowledge, rigour, and so on.
In the context of journal and monograph publishing, only so many things can be published in this journal issue or by this publisher. Peer review provides the editor or editorial board (who are probably also peers) with expert advice on the quality and suitability of your manuscript for this particular publishing outlet.
The person who wrote the detailed review of your manuscript is probably not the person making the decision about whether to publish your paper. Their primary purpose is to provide the editor(s) or editorial board with detailed and expert advice.
You receive copies of the reviewers comments so that you might give them serious consideration and improve your work. Doing so may or may not have any direct relevance to getting published with this journal/publisher. The note from the editor should make this clear.
Other evaluation processes also value the fact that your work has been through peer review and been considered worthy of publication. The fact that several experts in your field have read your work and agreed on its quality and significance guards against important decisions being made based on the idiosyncratic interpretations of your local colleagues, who may or may not be knowledgeable in your specialty.
It also indicates to non-academic users of your research that the work is generally accepted by your peers and not just your idiosyncratic opinion on the subject. They may know little about appropriate methods and so on and rely on the fact that experts in your field reviewed and accepted your work as evidence that it meets the appropriate standards.
I’ve written more about how peer review works in scholarly publishing, and provided practical guidance for authors and reviewers, in Peer Review (A Short Guide) published on 15 November 2015.
Edited and recategorized Sept 24, 2015. Additional information about the Short Guide added 8 October 2019.