Harry Potter and the Prisoner of Azkaban opens on the night before Harry's thirteenth birthday, when he receives gifts by Owl Post from his friends at school. The next morning at breakfast, Harry sees on television that a man named Black is on the loose from prison. At this time, Aunt Marge comes to stay with the Dursleys, and she insults Harry's parents numerous times. Harry accidentally causes her to inflate. Harry leaves the Dursley's house and is picked up by the Knight Bus, but only after an alarming sighting of a large, black dog. The Knight Bus drops Harry off at Diagon Alley, where he is greeted by Cornelius Fudge, the Minister of Magic. He rents a room and awaits the start of school. In Diagon Alley, Harry finishes his schoolwork, admires a Firebolt broomstick in the window of a shop, and after some time, finds his friends Ron and Hermione. At a pet shop, Hermione buys a cat named Crookshanks, who chases Scabbers, Ron's aging pet rat. Ron is most displeased. The night before they all head off to Hogwarts, Harry overhears Ron's parents discussing the fact that Sirius Black is after Harry.

The students board the Hogwarts Express train and are stopped once by an entity called a Dementor. Harry faints and is revived by Professor Lupin, the new defense against the dark arts teacher. Soon afterward, the students arrive at Hogwarts and classes begin. In divination class, Professor Trelawney foresees Harry's death by reading tealeaves and finding the representation of a Grim, a large black dog symbolizing death. In the care of magical creatures class, Hagrid introduces the students to Hippogriffs, large, deeply dignified crosses between horses and eagles. Malfoy insults one of these beasts, Buckbeak, and is attacked. Malfoy drags out the injury in an attempt to have Hagrid fired and Buckbeak put to sleep. In Defense Against the Dark Arts, Professor Lupin leads the class in a defeat of a Boggart, which changes shape to appear as the viewer's greatest fear. For Lupin, it turns into an orb, for Ron, a spider. Harry doesn't have a chance to fight it.

During a Hogwarts visit to Hogsmeade, a wizard village which Harry is unable to visit because he has no permission slip, Harry has tea with Professor Lupin. Harry discovers that the reason he wasn't allowed to fight the Boggart was that Lupin had worried that it would take the shape of Voldemort. This concern catches Harry by surprise, because Harry had been thinking even more fearfully about the awful Dementors. Snape brings Lupin a steaming potion, which Lupin drinks, much to Harry's alarm. Later that night, Sirius Black breaks into Hogwarts and destroys the Fat Lady portrait that guards Gryffindor Tower. The students spend the night sleeping in the Great Hall while the teachers search the castle. Soon afterwards, Quidditch moves into full swing, and Gryffindor House plays against Hufflepuff. During the game, Harry spies the large black dog, and seconds later he sees a hoard of Dementors. He loses consciousness and falls off his broomstick. Harry wakes to find that his trusty broomstick had flown into the Whomping Willow and been smashed in his fall, and the game itself had lost. Later, Harry learns from Lupin that the Dementors affect Harry so much because Harry's past is so horrible.

During the next Hogsmeade visit, from which Harry is forbidden, Fred and George Weasley give Harry the Marauder's map, written by the mysterious quartet of Moony, Prongs, Wormtail and Padfoot. This map leads him through a secret passageway into Hogsmeade, where he rejoins Ron and Hermione. Inside the Hogsmeade tavern, Harry overhears Cornelius Fudge discussing Sirius Black's responsibility for Harry's parents' deaths, as well as for the death of another Hogwarts student, Peter Pettigrew, who was blown to bits, leaving only a finger. Back at Hogwarts, Harry learns that Hagrid received a notice saying that Buckbeak, the hippogriff who attacked Malfoy, is going to be put on trial, and Hagrid is inconsolable. The winter holidays roll around. For Christmas, Harry receives a Firebolt, the most impressive racing broomstick in the world. Much to his and Ron's dismay, Hermione reports the broomstick to Professor McGonagall, who takes it away out of fear that it may have been sent (and cursed) by Sirius Black.

After the holidays, Harry begins working with Professor Lupin to fight Dementors with the Patronus charm; he is moderately successful, but still not entirely confident in his ability to ward them off. Soon before the game against Ravenclaw, Harry's broomstick is returned to him, and as Ron takes it up to the dormitory, he discovers evidence that Scabbers has been eaten by Crookshanks. Ron is furious at Hermione. Soon afterwards, Gryffindor plays Ravenclaw in Quidditch. Harry, on his Firebolt, triumphs, winning the game. Once all the students have gone to bed, Sirius Black breaks into Harry's dormitory and slashes the curtain around Ron's bed. Several days later, Hagrid invites Harry and Ron over for tea and scolds them for shunning Hermione on account of Scabbers and the Firebolt. They feel slightly guilty, but not terrible. Soon Harry, under his invisibility cloak, meets Ron during a Hogsmeade trip; when he returns, Snape catches him and confiscates his Marauder's Map. Lupin saves Harry from Snape's rage, but afterwards he reprimands him severely for risking his safety for "a bag of magic tricks." As Harry leaves Lupin's office, he runs into Hermione, who informs him that Buckbeak's execution date has been set. Ron, Hermione, and Harry are reconciled in their efforts to help Hagrid. Around this time, Hermione is exceptionally stressed by all of her work, and in a day she slaps Malfoy for picking on Hagrid and she quits Divination, concluding that Professor Trelawney is a great fraud. Days later, Gryffindor beats Slytherin in a dirty game of Quidditch, winning the Cup.

Exams roll around, and during Harry's pointless Divination exam, Professor Trelawney predicts the return of Voldemort's servant before midnight. Ron, Hermione, and Harry shield themselves in Harry's invisibility cloak and head off to comfort Hagrid before the execution. While at his cabin, Hermione discovers Scabbers in Hagrid's milk jug. They leave, and Buckbeak is executed. As Ron, Harry, Harry and Hermione are leaving Hagrid's house and reeling from the sound of the axe, the large black dog approaches them, pounces on Ron, and drags him under the Whomping Willow. Harry and Hermione and Crookshanks dash down after them; oddly, Crookshanks knows the secret knob to press to still the flailing tree. They move through an underground tunnel and arrive at the Shrieking Shack. They find that the black dog has turned into Sirius Black and is in a room with Ron. Harry, Ron, and Hermione manage to disarm Black, and before Harry can kill Black, avenging his parents' deaths, Professor Lupin enters the room and disarms him. Harry, Ron, and Hermione are aghast as Lupin and Black exchange a series of nods and embrace.

Once the three students calm down enough to listen, Lupin and Black explain everything. Lupin is a werewolf who remains tame through a special steaming potion made for him by Snape. While Lupin was a student at Hogwarts, his best friends, James Potter, Sirius Black, and Peter Pettigrew, became animagi (humans able to take on animal forms) so that they could romp the grounds with Lupin at the full moon. They explain how Snape once followed Lupin toward his transformation site in a practical joke set up by Sirius, and was rescued narrowly by James Potter. At this moment, Snape reveals himself from underneath Harry's dropped invisibility cloak, but Harry, Ron, and Hermione disarm him, rendering him unconscious. Lupin and Black then explain that the real murderer of Harry's parents is not Black, but Peter Pettigrew, who has been presumed dead but really hidden all these years disguised as Scabbers. Lupin transforms Scabbers into Pettigrew, who squeals and hedges but ultimately confesses, revealing himself to be Voldemort's servant, and Black to be innocent. They all travel back to Hogwarts, but at the sight of the full moon, Lupin, who has forgotten to take his controlling tonic (the steaming liquid), turns into a werewolf. Sirius Black responds by turning into the large black dog in order to protect Harry, Ron, and Hermione from Lupin. As Black returns from driving the werewolf into the woods, a swarm of Dementors approaches, and Black is paralyzed with fear. One of the Dementors prepares to suck the soul out of Harry, whose patronus charm is simply not strong enough. Out of somewhere comes a patronus that drives the Dementors away. Harry faints.

Harry awakens in the hospital wing to hear Snape and Cornelius Fudge discussing the fact that Sirius Black is about to be given the fatal Dementor's Kiss. Harry and Hermione protest, claiming Black's innocence, but to no avail; then Dumbledore enters the room, shoos out the others, and mysteriously suggests that Harry and Hermione travel back through Hermione's time-turning device, and save both Black and Buckbeak. Hermione turns her hour-glass necklace back three turns, and Harry and Hermione are thrust into the past, where they rescue Buckbeak shortly before his execution. From a hiding place in the forest, Harry watches the Dementor sequence and discovers that he had been the one who conjured the patronus, and he is touched and confused to note that his patronus had taken the shape of a stag that he recognizes instantly as Prongs, his father's animagi form. After saving his past self from the Dementors, Harry and Hermione fly to the tower where Black is imprisoned, and they rescue Black, sending him away to freedom on Buckbeak's back. The next day, Harry is saddened to learn that Professor Lupin is leaving Hogwarts because of the previous night's scare. Dumbledore meets with Harry and gives him wise fatherly advice on the events that have happened. On the train ride home, Harry receives an owl- post letter from Sirius that contains a Hogsmeade permission letter, words of confirmation that he is safe in hiding with Buckbeak and that he was, in fact, the sender of the Firebolt, and a small pet owl for Ron. Harry feels slightly uplifted as he returns to spend his summer with the Dursleys.