The Master and Margarita takes place in two worlds: Moscow, between Wednesday night and the following Saturday night, and Pilate's world, 2000 years before in Yershayalim, during Passover. The novel begins on a Wednesday night in Moscow at Patriarch's Ponds, where Mikhail Alexandrovich Berlioz and Ivan Nikolaevich Ponyrev have a mysterious encounter with Professor Woland, who is the devil. He challenges their atheism with a story, which is the reader's first introduction to Pilate's world. Pilate is questioning Yesha Ha-Nozri; though he does not want to condemn Yeshua, he realizes he must after he asks Yeshua about his conversation with Yehudah of Kerioth. Yehudah had betrayed him in front of state authority. After being pressured by the high priest Joseph Kaifa, Pilate publicly condemns Yeshua to death. Back in Moscow, Woland correctly predicts Berlioz's impending death by being beheaded by a streetcar.
Ivan is baffled and disoriented; he decides to get to the bottom of the evening's strange events, and embarks on a mad pursuit after Woland, Koroviev, and Behemoth the tomcat around the city. In the process he loses his clothes and causes a scene at Griboyedov's, where writers and critics have been waiting for Berlioz to start a meeting. The police are called, and Ivan is taken to Professor Stravinsky's mental hospital by Ryukhin. Ivan tells the doctor in a disorganized and crazed fashion that Berlioz died at the hands of a foreign professor, who was with Pontius Pilate at the time of Jesus' death; he is tranquilized when he attempts to jump from the window, and the doctor diagnoses him with schizophrenia and alcoholism. Later, when he wakes up in Chapter 8, he has a discussion with Professor Stravinsky in which logic is used to convince him that he must remain as a patient in the hospital.
Meanwhile, as Chapter 7 begins, Stepan Bogdanovich Likhodyev, or Styopa (and also Berlioz's roommate in apartment Number 50), wakes from a drunken night on the town to discover Woland in his room. Woland explains that Styopa agreed to sign his variety show to perform at the Variety Theater for seven performances and to advance him a payment of 35,000 roubles. Then Koroviev, Behemoth, and Woland chase him from the apartment and magically transport him to a jetty in Yalta, many miles away from Moscow.
Nikanor Ivanovich Bosoy, the house chairman of No. 302-b Sadovaya Street, where Berlioz lived, ventures to apartment number 50. There, he is convinced by Koroviev to call the Intourist Office to get clearance for Woland, to reside in the vacated apartment 50; Koroviev also bribes him with tickets to the theater and stuffs a bundle of money into his hand. As soon as he leaves the apartment, Koroviev reports Nikanor Ivanovich for speculating in foreign exchange, and having four hundred dollars in the ventilator flue of his toilet. In fact, Nikanor Ivanovich is stuffing the wad of bills into the ventilator flue, and five minutes later he is apprehended by the police.
Grigory Danilovich Rimsky, the financial manager of the Variety Theater, and Ivan Savelievich Varenukha, the house manager, are waiting for Styopa to arrive at work. After they receive a series of baffling telegrams reporting that Styopa is in Yalta, from Styopa himself, Rimsky instructs Varenukha to deliver the telegrams to the authorities. After ignoring a warning from Azazello in a telephone call not to take the telegrams anywhere, Varenukha is accosted and beat up by Behemoth and Azazello. Then they vanish, and are replaced by Hella, who kisses Varenukha, turning him into a vampire.
That night at the Variety Theater, Woland and his cronies put on a magnificent and confusing show. Behemoth rips off the head of George Bengalsky, the master of ceremonies, but puts it back on at the demands of the crowd. Koroviev, calling himself Fagot, opens a "ladies shop" on the stage, and all the women in the audience rush the stage to trade their own clothes for new, beautiful outfits. When Arkady Apollonovich Sempleyarov calls out for the trick to be revealed, Koroviev/Fagot reveals the man's extramarital affair in front of his wife and the whole theater.
Back in Ivan’s hospital room, a stranger in the window comes inside the room from the balcony; it is the Master. He listens to Ivan's story about Pontius Pilate, and then explains that he wrote a novel about the same topic, and that he knows Woland is the devil. After receiving scathing criticism, the Master fell into depression, and his beloved, the married Margarita, also became distraught. One night, he had an emotional breakdown, and Margarita sensed it and came to him; she promised to return in the morning and stay with him forever, but he committed himself to the hospital before she returned. He tells Ivan he hopes she has forgotten him, for he doesn’t want her to suffer being in love with a mentally ill man.
After Woland’s show, Rimsky has a terrifying encounter with the now vampiric Varenukha in his office. As Rimsky backs toward the window, he realizes a naked woman, Hella, is outside it, trying to break in. Just as Rimsky is sure he is about to die, a rooster crows in the garden and the woman curses and flies away, followed by Varenukha. Rimsky, instantly having become an old man from the stress, rushes outside and takes a cab to the train station, where he boards a train and vanishes.
Nikanor Ivanovich Bosoy is also committed the mental hospital. Ivan falls asleep and dreams of the world of Pontius Pilate. Matthu Levi is watching the execution of Yeshua Ha-Nozri. After giving the condemned men a drink, the executioner puts them out of their misery by pricking them in the heart with a spear. Aphranius proclaims them dead, and then a storm begins. Matthu uses a stolen knife to cut all the prisoners down from the posts, and runs off with Yeshua's body.
Back in Moscow, it is Friday morning, the day after Woland's show. Vasily Stepanovich Lastochkin, the bookkeeper, is in charge at the Variety Theater since all his superiors have disappeared mysteriously. After investigating officials dismiss the staff at the theater, he arrives at the Commission on Spectacles and Light Entertainment to report on the previous days events, to find Prokhor Petrovich, the chairman of the commission, to have disappeared; only his suit remains, and it is talking and conducting business as usual. His private secretary, Anna Richardovna, reports that it was Behemoth's doing. At the branch office of the Commission, Vasily Stepanovich finds the staff cursed to break out into song at certain intervals. In between bouts of involuntary singing, they beg for help because they cannot control their voices, and manage to explain that it was Koroviev's doing. At the financial office of the Entertainment Sector, Vasily Stepanovich is recognized as "one of those tricksters from the Variety Theater" and put under arrest.
Maxamilian Andreyevich Poplavsky, Berlioz's uncle, is arriving in Moscow from Kiev after receiving a confusing telegram from Berlioz, stating that he had just been run over by a streetcar. Maxamilian Andreyevich hurries to Moscow not to attend his nephew's funeral, but because he is interested in inheriting the now vacant apartment on Sadovaya in Moscow. At apartment Number 50, he is confused by Koroviev and Behemoth, and beaten by Azazello. Soon after, Andrey Fokich Sokov, the bartender and manager of the buffet at the Variety Theater, arrives at apartment Number 50 because the fake money that Woland distributed was used at the bar, and put the bar out a lot of money. When Woland informs him that he will die of liver cancer in nine months, Sokov seeks out Professor Kuzmin, one of the best liver doctors in town, to demand that his cancer be removed. After Sokov leaves, Kuzmin is confronted by a sparrow, and by a character that seems to be Hella, Azazello, and Woland combined.
On Friday, Margarita, who is distraught at the Master's disappearance, meets Azazello on a bench. Though she at first thinks he is insane, he confirms for her that the Master is in fact alive, and says that he will take her to see a foreigner who can reveal more information about her beloved to her. After giving her a little box with a magic cream inside and instructing her to rub it all over her body at half-past nine that evening, he disappears. At half-past nine, she does as she was told, and immediately transforms into a witch. Azazello calls her on the phone and tells her what to do; she flies from the window on a broom, becoming invisible. She flies to the critic Latunsky's apartment and wrecks havoc there, flooding the building. Then she is overtaken by her maid Natasha, who has also rubbed the cream all over herself, riding a hog, whom Margarita realizes is Nikolay Ivanovich. Margarita lands on a bank and dives into the stream, then departs the island for a party in Moscow.
Apartment Number 50 has been expanded by the fifth dimension, to Margarita's wonder. Azazello introduces her to Koroviev, Woland, Hella, Behemoth, and Abaddon. Koroviev explains to Margarita that she is to be the hostess at a ball thrown by Woland, and she agrees to assume the duties. At midnight, the group is transported to a huge hall, and they stop on a landing at the head of a staircase. At midnight, the guests begin to arrive: they leap from coffins that fall out of the fireplace. All the guests are introduced to Margarita, and all committed a heinous crime while they were alive. Baron Meigel enters; though he is not dead, he has apparently been eavesdropping; Abaddon and Azazello kill him. Woland and Margarita drink the Baron's blood. Then everything dissolves and she is returned to apartment Number 50; she enters through the open door in front of her.
Margarita finds herself back in Woland's bedroom, where nothing has changed since the ball. After dinner, Margarita demands that the Master be returned to her. He appears, and Behemoth miraculously produces an intact copy of his burnt manuscript. Woland disposes of Aloisy Mogarych, who wrote a denunciation of the Master after reading Latunsky's article, and has moved into the basement apartment, so that the lovers can return there. Woland also grants Natasha's wish to remain a witch, and Nikolay Ivanovich and Varenukha's wishes to return home as humans. Margarita and the Master are returned to the little basement apartment, with the intact manuscript, which Margarita reads.
A hurricane has overtaken Yershalayim, and Pilate meets in the palace with Aphranius, the head of his secret police. Pilate tells Aphranius that he has heard that there is a plot to kill Yehudah of Kerioth, who betrayed Yeshua Ha-Nozri, that night, and that the money paid him will be returned to the High Priest who paid it with a note. He tells Aphranius to "take every precaution for the safety of Yehudah of Kerioth," although he actually intends the opposite: he is instructing Aphranius to arrange for the man's murder.
With the help of Niza, an unfaithful woman, Aphranius tempts Yehudah to Gethsemane outside the city. There, he is apprehended by assassins; after he gives up the thirty tetradrachmas he received as blood money, he is killed. Meanwhile, Pilate dreams of walking toward the moon with Banga, along with Yeshua Ha-Nozri, with whom he has a philosophical discussion. He wakes up when Aphranius returns to confirm Yehudah's murder. Matthu Levi is also there; he had hidden Yeshua's body in a cave. Pilate offers him money, but he refuses it, and declares that he intends to kill Yehudah of Kerioth. When Pilate tells him that he himself has already killed Yehudah, he becomes upset, but then merely asks for a clean piece of parchment and leaves.
Margarita has finished reading the manuscript. Meanwhile, investigators are completely unable to make sense of the events that have taken place, due to the confusing testimonies presented. At four in the afternoon, a group of policemen arrive at apartment Number 50; after a gun fight with Behemoth in which, miraculously, nobody is injured, the tomcat escapes out the window, setting the apartment ablaze. The whole building begins to burn, and as its inhabitants evacuate, some people notice mysterious silhouettes flying out the window of apartment Number 50. Behemoth and Koroviev go to Griboyedov's, where they are admitted by Archibald Archibaldovich. Men show up and try to kill them, but they disappear. Griboyedov's catches on fire, burning to the ground.
It is now sunset, and Woland and Azazello are sitting on the stone terrace of a high building. Matthu Levi appears, and says that he has come because "He sent me" to request peace for the Master and Margarita. Woland agrees, and instructs Azazello to "Fly over to them and arrange everything." Azazello appears at the basement apartment, and says that Woland sent him to ask if they would like to go on a short trip with him; the two lovers agree. Azazello gives them a bottle of wine as a gift, and says it is the same wine that Pilate was drinking. The wine poisons the Master and Margarita, who collapse; however, soon Azazello revives them with the same wine, though they are now "dead." He sets fire to the apartment as they run outside and mount the three black horses waiting for them. They begin to fly on the horses. After a brief stop at the hospital to say good-bye to Ivan, they meet Woland, Koroviev, and Behemoth, also sitting on black horses, on a hill.
They set off into the sky, and as night falls, Margarita notices that her companions have changed in appearance, as their enchantments fall away. They land on a "flat, rocky, joyless mountaintop," where Pilate and Banga have been sitting for 2000 years. At Woland's direction, the Master declares to Pilate that he is free. Pilate rises, shouts something, and follows Banga down the path of moonlight. The Master and Margarita see that dawn is arriving, and they walk toward their eternal home, over a little bridge and along a sandy road.
The narrator reports that after Woland left Moscow, rumors echoed throughout the city about the events that happened during this story. He ironically gives credit to the investigating commission for coming up with bogus explanations for the events caused by Woland and his gang. George Bengalsky has recovered, but is too spooked to continue working at the Variety Theater. Varenukha has become extremely warm and responsive as a house manager. Styopa Likhodeyev has become manager of a large gastronomic establishment. Rimsky retired from the Variety Theater, and was replaced by Aloisy Mogarych. He annoys Varenukha just as Styopa once annoyed Rimsky. Old Andrey Fokich Sokov died of cancer just as Woland had predicted. Ivan has become a member of the faculty of the Institute of History and Philosophy, but he is still haunted by the full moon. So is Nikolay Ivanovich, who regrets not flying away with Natasha. Ivan dreams of Pilate walking with Yeshua Ha-Nozri, who tells him that he imagined the whole execution, and that in fact it never happened. In his dream, Ivan encounters Margarita and the Master, who assure him that "that was how it ended."