In case you don't know the movie, here's the plot:
In 1985, in a suburb south of Boston, John Bennett is a lonely child who wishes for his new Christmas gift, a teddy bear he names Teddy ("Ted"), to come to life to be his best friend. The wish succeeds with a falling star one night and Ted becomes fully alive. The newly sentient toy briefly becomes a minor celebrity, but never loses sight of his friendship with John.
Twenty-seven years later in 2012, John (Mark Wahlberg) and Ted (voiced by Seth MacFarlane), now living in the South End neighborhood of Boston, are still staunch, if immature, friends enjoying a hedonistic life, even while John is pursuing a relationship with an office worker named Lori Collins (Mila Kunis). Lori hopes to marry John, but she feels that he cannot move ahead with his life with Ted around, who is now a complete wastrel. John is resistant to kicking Ted out, but he is finally persuaded one night to act when he and Lori discover Ted at home with four prostitutes.
Soon, John finds Ted his own apartment and a job at a grocery store, where his irresponsible behavior on the job somehow manages to get him both promoted and acquainted with his co-worker Tami-Lynn (Jessica Barth). Ted and John still spend most of their time together, which irritates Lori when she discovers John has been skipping work to do so while using her for his excuses. Meanwhile, an obsessed stalker named Donny (Giovanni Ribisi), who idolized Ted as a kid, shows interest in possessing him for his destructive son Robert (Aedin Mincks). Things start to come to a head when Lori and John are invited to a party put on by Lori's manager Rex (Joel McHale), who has a lust for her. They attend, but Ted lures John away to a party at his apartment with the offer to meet Sam Jones, the star of their favorite movie Flash Gordon. Although John arrives with the intention of spending only a few minutes, he gets caught up in the occasion which gets completely out of control, with Sam persuading John and Ted to snort cocaine with him. Eventually, Lori discovers John there and breaks up with him in tears. At that, John blames Ted for ruining his life and tells him to stay away.
Eventually, Ted and John confront each other about their ruined friendship in John's hotel room and have a brawl after John provokes Ted, but soon manage to reconcile after the TV falls on John's crotch. To repair John's relationship with Lori, Ted arranges through Norah Jones (played by herself) for John to express his love for Lori with a song during a concert, being held at the Hatch Shell. Although John's performance proves an embarrassment, Lori is touched by the attempt while repelled by Rex's sneering. Later, Ted goes to visit Lori and explains that he was responsible for John's lapse: however, he offers to leave them alone forever if she goes to speak with him. Lori is persuaded, but moments after she leaves, Ted is kidnapped by Donny and taken to his house as Robert's unfortunate playmate.
Ted manages to distract Robert and reach a phone to contact John (but not before his ear is ripped off by Robert), but is soon recaptured. Realizing that Ted is in danger, John and Lori find Donny's residence and chase him and Robert to rescue Ted. The chase leads to Fenway Park, where Robert tries to stop John and Lori from getting to Ted first, only to have John knock him out. During the chase, Ted gets himself damaged and just when Donny grabs him on the tower, Ted falls onto the field, torn completely in half. Donny is forced to flee when a police car shows up. As John and Lori gather his stuffing, Ted relays his wish that John be happy with Lori, as his life fades away.
Unable to accept Ted's death, John and Lori return to her apartment to try to repair him, but it proves useless. That night, Lori makes a wish on a falling star. The next morning, Ted is magically restored and the couple reconcile with Ted, who encourages John and Lori to resume their relationship. With that resolution, John and Lori get married (with Sam Jones as their priest) and Ted accepts having his own life.