How I Met Your Mother featured Barney, played by Neil Patrick Harris, typing up a blog entry. The blog looks suspiciously like Doogie Howser's computer diary, and suspiciously familiar music plays in the background.
Another episode had Barney (Neil Patrick Harris) using actors to play the roles of his family. About his [faked] son, he comments that "Child actors were better 20 years ago," which is exactly what (and when) Harris used to be.
Another one is with Alyson Hannigan's character. When having cold feet before her marriage, one of the items on the list of experiences to have is a big lesbian experience. Her most famous role is lesbian witch Willow from Buffy the Vampire Slayer.
Lily's demon eyes and voice (Slapsgiving, The Stinson Missile Crisis, The Lobster Crawl, The Lockett) is suspiciously similar to "Dark Willow" from season six of Buffy.
Also Lily's favorite name for her baby: Tara, the name of Willow's girlfriend in Buffy. At the wedding she wants the Kennedy package, which just so happens to be Willow's other girlfriend.
And Willow once mentioned writing Doogie Howser fanfics. (Apparently, these things work retrospectively as well.)
Season 5, "The Playbook": Barney creates a website that features a picture of him, in scrubs, with a stethoscope around his neck. Hmmm, where have we seen that before?
In "Blitzgiving", Jorge Garcia played a cameo role. At one point someone asks for random numbers and he immediately shouts "4,8,15,16,23,42!" the Arc Numbers from LOST. His character is also cursed with being unlucky (as was his Lost character), and compares said curse with being on an island for eternity.
The episode "Bad News" has Neil Patrick Harris playing a doctor once again.
Season 8 episode "P.S. I Love You" featured a cameo from Dave Coulier, Bob Saget's (the narrator) Full House co-star. Coulier does his signature "cut-it-out" routine followed by Saget saying "I always liked that joke."
The season seven episode "No pressure" has Barney compare Lily and Marshall to preppy kids who stage and bet on hobo fights. NPH was a preppy kid who staged and bet on hobo fights on Boomtown.
Season 3, "Wait for It": When Ted is making out with Mandy Moore's character at the bar, her song "Nothing That You Are" is playing in the background.
Barney aka Neil Patrick Harris pretends to be Neil Armstrong and spend about a minute one of his women spends going "Neil, Neil, Neil, Neil...Armstrong"
Jason Segel plays Marshall, who has a longtime dream of becoming an environmental lawyer and working to protect the environment. This may be a reference to Segel's character of Mike in the 1999 film SLC Punk!, who leaves Salt Lake City for the University of Notre Dame in order to study botany and (guess what?) save the rain forests.
Robin's doppleganger is basically her as a lesbian. Cobie Smulders previously played a lesbian in season two of The L Word.
Sarah Chalke's character is a dermatologist. She is most well know for playing Dr. Elliot Reid in Scrubs.
In the same episode, when asked about the song that Robin had done, "PS I love you", Coulier said "Why do they always think it's about me?". Coulier was (allegedly) the subject of Alanis Morissette's song You Oughta Know, and Alannis was the inspiration for Robin Daggers
In a season 6 episode, Robbie Amell plays a character who goes by "Scooby" and acts like a dog. He was in two Sccoby Doo movies.
During their conversation in "Garbage Island" when Ted thinks The Captain (played by Kyle MacLachlan) suspects him of breaking up The Captain and Zoey's marriage, Ted spits out his brandy in shock and tries to cover it by saying "That's some damn good brandy." This is likely a nod to MacLachlan's role as Special Agent Dale Cooper on Twin Peaks, who repeatedly exclaims some variation on "That's some damn good coffee!"; the first time he does so is after a Spit Take.
The actor who plays The Captain also played Orson Hodge in Desperate Housewives, a character who steals objects from people who are rude to him. In The Ashtray Lily steals his ashtray because she believes he was rude to her and calls it 'Aldren Justice'.
This could be a coincidence, since he's the second actor to play the role (the first one refused to reprise the role), but... Ray Wise plays Robin's father, a scarily intense man who has a rather twisted relationship with his daughter, all of which makes him rather similar to Wise's best known TV role in Twin Peaks. (Though obviously the dad in Twin Peaks turned out to be far more horrible than Robin's dad.) Since the character was already was already established before Wise was cast, it could also be a Casting Gag.
Another possible coincidence for "The Mother" (Cristin Milioti), who earned a Tony nomination as "Girl":
Entertainment Weekly: What is it with you and nameless characters? Cristin: You know what? You are the first person to bring that to my attention, and you've blown my mind. Maybe I don't have a memorable face. [Ed. note: not true.]