Hannigan was born in Washington, DC, the only child of Emilie (Posner) Haas, a real estate agent, and Al Hannigan, a truck driver. Her father is of Irish ancestry and her mother is Jewish. Her parents divorced when she was two, and she was raised mostly by her mother in Atlanta, Georgia.
At age four, Hannigan began appearing in commercials. She moved to Hollywood at age 11. Living with her mother and attending North Hollywood High School, she successfully auditioned for agents while visiting her father in Santa Barbara. After attending North Hollywood High School, she attended California State University, Northridge, where she was a member of the Alpha Chi Omega sorority and earned a degree in psychology.
Hannigan's first major film role was in My Stepmother Is an Alien, a science-fiction comedy released in 1988; one of her co-stars in the film was actor Seth Green, who later joined her in the regular cast of Buffy as her on-screen boyfriend. Then in 1989, her first regular role on a TV series came when she was cast in the short-lived ABC sitcom Free Spirit. As a teenager, Hannigan babysat for the children of her future How I Met Your Mother costar, Bob Saget.
In 1997, Hannigan was cast to play Willow Rosenberg, Buffy Summers' best friend, on the television series Buffy the Vampire Slayer. The show became a success, and Hannigan gained recognition, subsequently appearing in several films aimed at teenaged audiences, including American Pie (1999), Boys and Girls (2000), American Pie 2 (2001), and American Wedding (2003). She also had a guest spot on the Buffy spin-off, Angel, reprising her role of Willow in a few episodes (including most notably "Orpheus", during the fourth season of Angel and the seventh season of Buffy), but none after Buffy finished production.
In early 2004, Hannigan made her West End debut, starring in a stage adaptation of When Harry Met Sally... at the Theatre Royal Haymarket, opposite Luke Perry.
In 2005, Hannigan returned to starring in a regular television series, taking the main role of Lily Aldrin in the hit comedy How I Met Your Mother, and also playing a recurring guest role on Veronica Mars as Trina Echolls. In February 2006, Hannigan starred as Julia Jones in Date Movie, a parody of romantic comedies. She was also a guest star on the ABC animated sitcom The Goode Family in 2009.
Hannigan joined forces with Emily Deschanel, Jaime King, Minka Kelly, and Katharine McPhee in a "video slumber party" featured on FunnyorDie.com to promote regular breast cancer screenings for the organization Stand Up 2 Cancer.
In 2012, Hannigan reprised the role of Michelle in American Reunion.
Since 2016, Hannigan has hosted the television series Penn & Teller: Fool Us.
Hannigan married her Buffy the Vampire Slayer recurring co-star Alexis Denisof at Two Bunch Palms Resort in Desert Hot Springs, California, on October 11, 2003. The couple have two daughters, Satyana Marie Denisof, born on March 24, 2009 (which is also Alyson Hannigan's birthday) and Keeva Jane Denisof, born May 23, 2012. Alyson and Alexis live with their two daughters in Encino.