At the very center of The Portrait of Dorian Gray is, of course, the portrait itself. It becomes a constant presence both in the mind of Dorian and in the mind of the reader, an extended metaphor for the moral cost of utterly self-serving behavior:
Ah! in what a monstrous moment of pride and passion he had prayed that the portrait should bear the burden of his days, and he keep the unsullied splendour of eternal youth! All his failure had been due to that. Better for him that each sin of his life had brought its sure swift penalty along with it. There was purification in punishment. Not “Forgive us our sins” but “Smite us for our iniquities” should be the prayer of man to a most just God.
This portrait metaphor, addressed directly in Dorian’s eruption in this passage, is significant enough to transform the story as a whole into a sort of allegory. Try as Dorian might to avoid moral consequences for his rapidly accumulating transgressions, they nonetheless are brought to bear on the increasingly terrifying painting hidden in his house. His “pride and passion,” in the end, are the cause of his unintentional suicide: in striking against the painting that has come to embody his sin, Dorian strikes at the heart of his own being and dies because of it.
As an allegory, then, does The Portrait of Dorian Gray warn the reader not to succumb to the temptations of selfishness? Does Wilde mean to warn the reader that, inevitably, one's sins are reflected in their character in one way or another? Perhaps, but, as Wilde warns in his preface, books are often the victims of spurious attempts to moralize works of aesthetic value that were never designed to carry such messaging. An alternate reading of this allegory could therefore conclude that Dorian’s dramatic descent into the depths of depravity in the aftermath of learning about hedonistic philosophy and reading Lord Henry’s “poisonous book” is a satirically exaggerated thought experiment, meant to critique the protestation and censoring of literature for its perceived effect on the reader’s character.