So, I was just watching an episode of Supernatural that involved imaginary friends, and it occurred to me that there have actually been quite a few shows and movies that have dealt with this concept. (And probably books and other media.) So I thought maybe I'd make a list of all such things that I've seen (at least that I can recall). Imaginary friends can take many different forms. Some are truly imaginary, and others are real (they may be supernatural creatures or extraterrestrials, etc.) Some are friendly, others malevolent. Some are quite ambiguous (as to whether or not they're real, and whether or not they're friendly). And how they are perceived by the people (usually children) who are friends with them also varies. Some people believe they're real (whether they're right or just delusional). Some claim they can actually see and/or hear them, while others can't. Some are happy to have such friends, others wish their imaginary friends would leave them alone. Note: this list will not include imaginary friends who appear as actual objects, such as toys, unless it's clear that the person imagining them seems to see a manifestation beyond the object itself. (So Hobbes counts, but things like Plank and Mr. Hat don't.)
As for myself, when I was young, I had an imaginary friend named Debbie. I don't remember anything specific about her, like why I gave her that name or what we might have talked about. But I do have the impression that I made a conscious decision to have an imaginary friend just because it was something I'd heard of, and I guess I kind of thought it was something kids were supposed to do. I don't know when I first imagined her or when I stopped talking to her, and I don't think I actually talked with her that often (though I could be wrong about that). I do know that I was always entirely certain that she wasn't real, and I never saw or heard her, nor did I ever bother imagining what she looked like. (Which might explain why I have no interest in describing the appearances of characters I write, now. Or not.)
Anyway... here's the list:
The Amityville Horror (1979)
A young girl named Amy has an unseen "friend" named Jody, who isn't so much imaginary as supernatural and kind of scary.
Calvin and Hobbes (1985-95)
A comic strip in which a young boy named Calvin has a stuffed tiger named Hobbes, who appears only to Calvin himself as a real(ish) tiger and best friend.
Cloak & Dagger (1984)
A movie about a boy who witnesses a murder and investigates it with his imaginary friend, Jack Flack.
Doctor Who (series 5) (2010)
Amelia Pond met the Doctor when she was seven years old, and spent the next twelve years waiting for him to return. Over time she came to think of him as an imaginary friend, "the Raggedy Doctor," though of course she eventually learned that he was real.
Donnie Darko (2001)
A movie that I might not have thought of as being about an imaginary friend, but there is an (apparently) hallucinatory being... and... I dunno what else to say about that.
Don't Look Under the Bed (1999)
A TV movie about a teenage girl named Frances who meets an imaginary friend (not hers) named Larry Houdini. They have to work together to thwart a Boogeyman.
Drop Dead Fred (1991)
A movie I'm fairly sure I haven't seen (or if I did, I don't remember it).
Everything You Want (2005)
A TV movie about a woman named Abby who never gave up her childhood imaginary friend, Sy, who eventually became her imaginary boyfriend.
Foster's Home for Imaginary Friends (2004-09)
A TV series in which most of the characters are imaginary friends. In this reality, kids imagine friends, who then become real, but when a kid grows up, the friend has to wait to be adopted by a new kid. So there's a sort of orphanage just for imaginary friends.
Happy! (2017)
A TV series based on a four-issue comic book from 2012 (which I haven't read). Happy is a little flying unicorn who is the imaginary friend of a young girl named Hailey. He seeks help from a former cop named Nick Sax when Hailey is kidnapped by a deranged man dressed as Santa Claus, who has also abducted a number of other children.
Harvey (1950)
A movie that I don't think I've ever seen, but I'd like to.
Heart and Souls (1993)
The souls of four people who die when a baby is born are tethered to the baby through some invisible force, so they become friends with him throughout his first seven years (and later when he's an adult). Not really imaginary friends, but the boy's parents thought that's what they were.
Hide & Seek (2005)
A movie about a little girl named Emily who has an imaginary friend named Charlie... but I don't want to spoil the truth about Charlie.
Imaginary Fiend (2000)
An episode of The Powerpuff Girls, in which a boy named Mike Believe has an imaginary friend named Patches, who causes a lot of trouble.
Imaginary Friend (1992)
An episode of Star Trek: The Next Generation, in which a girl named Clara has an imaginary friend named Isabella, who turns out to be an alien entity.
Imaginary Friend (2016)
A very short horror film about a young girl's not-so-imaginary friend.
Imaginary Mary (2017)
A sitcom about a woman named Alice, whose childhood imaginary friend Mary (a cute-ish CGI creature) returns to help Alice get over her fear of meeting her current boyfriend's kids from a previous marriage.
Inside Out (2015)
A movie about a girl named Riley, seen mostly from the perspective of anthropomorphized emotions within her mind. Two of those emotions, Joy and Sadness, meet Riley's former imaginary friend, Bing Bong. He tries to be helpful, but sometimes his efforts backfire. In the end, he's rather heroic, though. (We never really get to see him interacting with Riley herself, except in memories.)
Just My Imagination (2015)
An episode of Supernatural, in which Sam's childhood imaginary friend, Sully, turns out to be a supernatural creature called a Zanna. He returns to Sam now to ask for his help when another "imaginary" friend is murdered. (Four Zanna appear in the episode.) There was a previous episode with the concept of imaginary friends- though not Zanna- but I don't remember it.
The Koos Is Loose (1997)
An episode of Dexter's Laboratory, in which Dee Dee has an imaginary friend named Koosalagoopagoop, who turns out to be real. He reappears in three other episodes of the series, and is mentioned in the "Imaginary Fiend" episode of Powerpuff Girls.
Moone Boy (2012-15)
A TV series about a boy named Martin who has an imaginary friend named Seán Murphy. Viewers can see and hear Sean, though only Martin can see him on the show. There are other imaginary friends, who can see and hear each other, but each kid can only see his own imaginary friend. It's unclear whether they're real or not.
Pete's Dragon (1977)
A movie about a kid named Pete who has a dragon friend named Elliott. People thought it was imaginary, but it turned out not to be. I saw the movie years ago, but I don't remember it well enough to say much.
Puff and the Incredible Mr. Nobody (1982)
The third "Puff the Magic Dragon" special, in which a boy named Terry has an imaginary friend named Nobody, who allows Terry to bring out his artistic talents and whatnot.
Ranger and the Very Real Imaginary Friend (2015)
An episode of Gortimer Gibbon's Life on Normal Street, in which Ranger's childhood imaginary friend, Iggy, shows up when Ranger is reluctant about the changes that come with growing up. Interestingly, Iggy is played by Nate Torrence, who also played an imaginary friend in the "Just My Imagination" episode of Supernatural.
See No Evil (1993)
An episode of Batman: The Animated Series, in which a girl named Kimmy has an imaginary friend named Mojo, who turns out to be her estranged father, using an invisibility cloak.
Sesame Street (1969-present)
A children's show that includes a Muppet named Big Bird, whose friend Mr. Snuffleupagus was introduced in 1971, and the adult characters on the show believed he was imaginary until they finally met him themselves in 1985.
The Shining (1980)
According to Danny Torrance, "Tony" is "the little boy who lives in my mouth." But his mom thinks Tony is Danny's imaginary friend. (I'd say they're both wrong about what Tony is, but at least he rates a mention here.)
So You've Grown Attached (2014)
A short film about a girl named Izzy who is getting a bit too old for her imaginary friend, Ex.
The Torkelsons (1991-92)
A TV series about a teenage girl named Dorothy Jane, and her family. There isn't exactly an "imaginary friend" in the show, but Dorothy Jane does sometimes talk to the Man in the Moon as if he were a friend. And I'll take any chance to mention what a great show it was, so I might as well give it a shout out, here.
Treehouse of Horror XXVII (2016)
In one segment of this year's installment of The Simpsons's annual Halloween special, Lisa has an imaginary friend named Rachel, who starts killing Lisa's real friends, out of jealousy.
The Whispers (2015)
A TV series in which several children have an imaginary friend named Drill, whom they can't see, but they can hear. He turns out to be an alien entity with plans to invade the Earth.
Wilfred (2011-14)
A TV series about a man named Ryan whose neighbor's pet dog, Wilfred, appears to Ryan as a man in a dog suit and converses with him, unbeknownst to Wilfred's owner. I only watched maybe the first couple episodes.