Jon's recurring anxiety dream explained in panels one and two are fine illustrations of Dr. Freud's explanations of the unconscious' dream-work. The "day residue", in which conscious thoughts from the waking day crop up in the dream, of Jon's dream is both literal - Jon really does find himself locked outside without his pants - and a dream element that manifests his unconscious desire to be more a outgoing and openly sexual person. In the special case of nightmares repressed wishes from formative years which the id wishes to see fulfilled are straining against the more recently developed adult ego which tries to sublimate the infantile urges. The polymorphous perversity of running around without one's pants would probably be too literal for Freud's liking, but the id's extra touch of locking the front door to thwart Jon's ego is funny. In an inventive only-in-Garfield riff on postmodern storytelling and Freud's dream-work, Jon's ego's attempts to censor the infantile drives are the framing of the comic strip itself, which protects all views of the depantsed dreamer far off-panel.
Presumably the end of the joke today is that Jon is not dreaming, though this is never made explicit. Either way, Jon indicates that when he has the pantsless dream, Garfield is normally present, as the cat's presence does not confuse or startle the dreamer. Garfield's role in Jon's dream must be closer akin to Jung's archetype of the Shadow: a dream figure for the irrational, unpleasant urges the conscious mind tries to repress, in some aspects we might say the opposite of the dreamer's. The tidal wave of indulgence in bad behavior that Garfield represents seethes in the collective unconscious, taking pleasure in the perpetual anxiety dream existence of the Jon Arbuckles of the waking world.