Scarred by his experience at the Ministry of Magic with Voldemort, Harry is reluctant to return to Hogwarts. Dumbledore encourages him to continue, after transporting him to see a former professor, Horace Slughorn, hoping that Slughorn would return to Hogwarts and take Harry under his wing.
Meanwhile, Death Eaters begin to wreak havoc both towards Muggles, destroying the Millennium Bridge, and Wizards, kidnapping the wandmaker Mr. Ollivander and destroying his Diagon Alley shop. Bellatrix Lestrange entreats Severus Snape to enter an Unbreakable Vow with Draco Malfoy's mother, Narcissa, assuring that he will complete the task assigned to Draco should Draco fail and that he will protect him and make sure he doesn't get hurt. Harry, Ron and Hermione, while in Diagon Alley, spot Draco entering Borgin and Burkes and taking part in a ritual with other Death Eaters, and become suspicious of his actions.
At Hogwarts, the school is under tight security to prevent the Death Eaters from entering the school. With Slughorn back to teach Potions, Snape is given Defense Against the Dark Arts. Harry and Ron are encouraged by Professor McGonagall to take up Potions now that Slughorn, with lower standards, is teaching the class; however, as neither was expecting to take the course, they have to find textbooks for themselves in the bookcase. Harry's book is annotated with more exact instructions to complete potions, giving him an edge over the other students; he finds that it once belonged to the "Half-Blood Prince", a term Hermione cannot figure out. Meanwhile, Ron becomes the successful Gryffindor's Quidditch goalie, attracting the love of Lavender Brown, much to Hermione's chagrin. Harry is also upset over Ginny's attraction to Dean Thomas. During the Christmas Break while Harry and Ron are at the Burrow, the Death Eaters with Bellatrix in charge come intending to kidnap Harry, but are forced to retreat after they are outnumbered by Order of the Phoenix members. Before they leave they set fire to the Burrow, and the Weasleys are gathered outside the house, leaving Harry regretting the evil that he has brought down upon people he cares about.
Dumbledore reveals to Harry through the Pensieve memories of Tom Riddle (Voldemort's original name), including a false memory from Slughorn, when Riddle asked him about a certain restricted Dark Art. The memory fails to reveal this art, and Dumbledore believes that the key to defeating Voldemort is to learn what Dark Art Riddle asked about, and instructs Harry to further confide himself to Slughorn. Using a Luck potion he won earlier in the school year, Harry is able to bring Slughorn to be intoxicated with Hagrid and convinces the professor in his stupor to give him the true memory. This memory reveals that Riddle inquired about the creation of Horcruxes, devices that store a portion of the creator's soul to allow them to live indefinitely. Dumbledore reveals that Riddle's diary and his mother's ring were two of seven Horcruxes that Riddle had created, and that they must track these down and destroy them to make Voldemort mortal.
Meanwhile, Harry continues to be suspicious of Draco's actions, following him around the school but no success in determining what he seeks. Harry believes Draco to be behind two indirect attempts on Dumbledore's life, one through a cursed necklace that Katie Bell, under an Imperius Curse, was bringing to Dumbledore as a gift, and another through a bottle of poisoned wine that Slughorn, similarly cursed, planned to give to the professor. The latter is discovered accidently when Ron ingests the poison; though he recovers with medical treatment, he unconsciously mumbles Hermione's name in front of Lavender, sending her away crying. After this incident, Harry corners Draco in the toilets and after a short fight casts the Sectumsempra curse from the Half-Blood Prince's book, severely harming Draco. Snape arrives knowing that he let Draco get hurt and that he broke one of the promises and heals him. Ginny convinces Harry to hide the book in the Room of Requirement to prevent him from using it again; there, they discover, unknown to them, a Vanishing Cabinet, which Draco has been attempting to repair, but think nothing of it further. Ginny also reveals her love for Harry, and they kiss after she hides the book.
Dumbledore implores Harry to help him recover another Horcrux, the location of which he recently learned. The two transport themselves to a seaside cliff, and enter a cave where the Horcrux is located. On a small crystalline island, Dumbledore forces Harry to make him drink a mind-altering liquid in order to reveal the Horcrux. While Dumbledore recovers from the liquid, Harry recovers the Horcrux, a small pendant. Harry tries to help Dumbledore recover, but they are attacked by numerous inferi. Dumbledore recovers in time to set them aflame, and the two return to the Astronomy Tower at Hogwarts.
Dumbledore, still weakened by the trial, instructs Harry to go to get Snape. However, before Harry can go, footsteps are heard, and Dumbledore tells Harry to hide on the lower floor. The footsteps belong to Draco, who prepares to kill Dumbledore, but cannot bring himself to do so. Meanwhile, with the Vanishing Cabinet fixed, Bellatrix and other Death Eaters are able to invade Hogwarts through a similar cabinet at Borgin and Burkes, and join Draco in the tower. Snape silently arrives on the lower floor, indicating to Harry to stay quiet, and then goes upstairs, joining the other Death Eaters. Snape then casts the killing spell Avada Kedavra on Dumbledore, throwing him over the side of the Tower and killing him. Snape, Draco, and the other Death Eaters depart the school, Bellatrix casting the Death Eaters' sign over the school, destroying the Great Hall and setting fire to Hagrid's hut in glee. Harry tries to stop them with the Sectumsempra spell, but Snape deflects it and stuns him. As he departs, he explains to Harry that he is the Half-Blood Prince and the creator of the spell.
Harry returns to the school to find the staff and students mourning over Dumbledore's death. Harry walks over to Dumbledore's body lying in front of them, grieving as Ginny comforts him. When he returns to the late headmaster's office one last time, McGonagall confronts him and asks him to open up to her, but he does not comply and leaves. A portrait of Dumbledore can be seen hanging on a wall behind them.
Harry reveals to Ron and Hermione that the Horcrux they got was a fake, containing a message from an "R.A.B." that stated he had already taken it, but is also seeking to end Voldemort's life. Harry tells his friends that he does not plan to return next year, instead seeking out R.A.B. and the other Horcruxes so that he may put an end to Voldemort; Ron and Hermione remind Harry that they are his friends and will help alongside him in his goal.