John Bennett has been divorced from Lori for six months. Meanwhile, his best friend Ted the teddy bear marries his girlfriend, Tami-Lynn. Following a heated argument after being married a year, they decide to have a child. As Ted doesn't have sperm, John agrees to help find a donor. They ask Sam J. Jones but he declines due to a sperm count of one. Then they unsuccessfully try to break into Tom Brady's house and steal his sperm. Ultimately, John offers to donate his sperm.
Despite Ted and John's efforts, Tami-Lynn's historical drug use has rendered her infertile (despite having been clean for an extended period of time) and they decide to adopt. The background checks put Ted's legal status as a person into question. The state authorities of Massachusetts declare Ted property rather than a person, resulting in the loss of his job, his credit card and bank accounts are frozen and his marriage to Tami-Lynn is forcibly annulled.
John suggests that they take the state to court. They ask the best lawyer they can find, but he offers to assign their case pro bono to his niece Samantha, a novice lawyer. They are initially reluctant, but bond over their love of marijuana as they prepare to present the case.
Meanwhile, Donny, Ted's life-long stalker, is a janitor at the headquarters of toy company Hasbro, in New York City. He convinces the company CEO to hire an expert attorney to ensure that Ted maintains his status as property, leaving him open to seizure by the firm to create more living teddy bears.
Despite Samantha's best efforts, the court rules against Ted. Disheartened and desperate, the trio contact Patrick Meighan, a highly respected civil rights attorney, to help overturn the court's decision. Driving to Manhattan, the trio meet Meighan, who is sympathetic to Ted's plight but refuses the case, as he believes Ted has not significantly contributed to humanity due to his lifestyle.
Ted, angry at the injustice and jealous of Samantha and John's relationship, stomps off. Donny follows him as he wanders into the New York Comic-Con. Once inside, Donny, disguised as a Teenage Mutant Ninja Turtle, attempts to kidnap Ted, who flees and contacts John for help. John and Samantha arrive and find Ted, just as Donny is about to cut him open. As they make their escape, Donny severs the cables holding up a model of the USS Enterprise with a knife and it swings towards Ted. John pushes Ted out of the way, takes the hit, and is knocked unconscious. Ted identifies Donny from a group of Ninja Turtle cosplayers through his need to dance to "I Think We're Alone Now" and he is arrested.
At the hospital, Samantha, Ted and Tami-Lynn rejoice when John recovers. Patrick Meighan decides to take the case, inspired by John's selflessness and Ted's emotions over his nearly fallen friend. Meighan gets the ruling overturned by demonstrating that Ted is self-aware, that he feels complex emotions, and is capable of empathy. Outside the courthouse, Ted re-proposes to Tami-Lynn. After they are remarried, Ted and Tami-Lynn, adopting the surname of "Clubber-Lang", adopt a baby boy, who they name Apollo Creed, while John and Samantha happily pursue their own relationship.
In a post-credits scene, the customer who had previously purchased a box of Trix wanders back into the supermarket, visibly injured. He leaves the Trix behind and exits with a look of betrayal.
Mark Wahlberg as John Bennett
Seth MacFarlane as Ted Clubber-Lang (voice and motion capture)
Amanda Seyfried as Samantha Jackson
Jessica Barth as Tami-Lynn McCafferty
Giovanni Ribisi as Donny
Morgan Freeman as Patrick Meighan (special appearance)
John Slattery as Shep Wild
Patrick Warburton as Guy
Michael Dorn as Rick
Bill Smitrovich as Frank
Cocoa Brown as Joy
John Carroll Lynch as Tom Jessup
Ron Canada as Judge Matheson
Jessica Szohr as Allison
Jay Patterson as Karl Jackson
Tara Strong as Ted's "I Love You" function
Sam J. Jones as himself
Sebastian Arcelus as Dr. Ed Danzer
Maggie Geha as Female Nurse
Tom Brady as himself
Dennis Haysbert as Fertility doctor
Taran Killam as himself
Jimmy Fallon as himself
Jimmy Kimmel as himself
Jay Leno as himself
Bill Maher as himself
Kate McKinnon as herself
Bobby Moynihan as himself
David Hasselhoff as himself
Liam Neeson as Trix Customer
Lenny Clarke as Cop
Patrick Stewart as Narrator
Curtis Stigers as Wedding singer
Nana Visitor as Adoption agent
Ralph Garman as Stormtrooper
Jack Knight as Todd Kidder