The story picks up where the series' previous installment, The Maze Runner, left off. The Gladers have escaped the Maze and are resting in dorm-like chambers in the rescue facility. The Maze was a horrific set of trials set up as a human experiment. The boys and Teresa are unsure of what is going to happen next. When Thomas wakes up, he finds that zombie-like Cranks are attacking the facility. Cranks are humans who have gone insane, slowly being eaten up by a virus called the Flare. Thomas finds the dead bodies of their rescuers hanging in a nearby room. When he goes to look for Teresa, he finds a boy named Aris instead in her place. Aris claims to have been the only boy in Group B, much like Teresa was the only girl in Group A. Group B has escaped their own Maze, but Aris does not know how he got to the Group A facility. A series of mysterious events take place, wherein the dead hanging bodies disappear. The boys also discover strange 'roles' dictated by tattoos on their necks. Thomas and his friends are left alone for several days, during which they slowly starve. Finally, a strange man appears in the facility, protected by a force-field. Food has also arrived. The man, who works for WICKED, is nicknamed 'Rat Man' by the boys, a reference to his appearance. Rat Man tells the boys that Phase 2, the Scorch Trials, are about to begin for them. After delivering instructions for the coming days, Rat Man leaves.
Thomas and the Gladers follow Rat Man’s instructions and step through the force-field, called a Flat Trans, the next morning. They are delivered into a tunnel, during which a strange slicing contraption kills several boys. The boys emerge into a sun-baked wasteland and have to cover themselves in order to move towards the 'Safe Haven' that Rat Man told them about. They have a certain amount of days to reach the Safe Haven, where a cure has been left for them. Rat Man had said that all the boys have the Flare virus, which is why they need to reach the Safe Haven. As they move towards the desert, they advance towards a city. Before they reach the city, they hear sounds of girls screaming. The missing Teresa suddenly appears in the distance, and pulls Thomas into a nearby shack. She attempts to warn him of something, and also kisses him. She ducks away soon, however, leaving Thomas confused and upset.
Before the group reaches the city, a terrible lightning storm also strikes the barren land, killing some of the Gladers. To escape the storm, the boys take refuge in a shelter. A group of Cranks hops down and confronts them. Their leader, Jorge, gets into a fight with Minho. Jorge is about to kill Minho when Thomas insists on talking to Jorge one-on-one. During their talk, Thomas manages to convince Jorge to help them get to the Safe Haven and also receive the cure for his Flare. Jorge agrees, and says he will only take one other member of his gang, a girl named Brenda. Jorge and Brenda take Thomas and his friends to a tunnel location to eat. Another faction of Jorge’s group, upset that Jorge did not take them along, causes an explosion in the tunnel entrance. This separates Thomas and Brenda from the rest of the group. Brenda has been very flirty with Thomas the entire time. Brenda tries to take Thomas through the underground passages to reach the Safe Haven, but they are attacked by very 'Gone', or very insane, Cranks. As they take the route on the surface, they are kidnapped by a group of half-Gone Cranks who own a gun. These Cranks want to know why Thomas’s name is, strangely, plastered all over the city on signs. As the Cranks are questioning them, Minho and the rest of the separated group come to the rescue. However, in the ensuing escape, the Crank who owns the gun shoots Thomas.
Delirious, Thomas drifts in and out of consciousness. WICKED personnel take him up into a 'Berg' aircraft to heal his shoulder. After being returned to the ground to his friends, Thomas advances with the group towards a set of mountains. The Safe Haven should be on the other side of the mountains. However, Teresa shows up, armed. She is with the rest of the girls from Group B, who are also armed. They have commands from WICKED to take Thomas and to kill him in the mountains. Thomas relents, and lets them take him. Teresa beats up Thomas when he tries to talk. However, the whole situation is confusing because she also whispers a few times to him, saying that this is all an act and things will be over soon. Thomas manages to convince the rest of the girls not to kill him, but then Teresa takes him away in the middle of the night. Aris also reappears, apparently in cohort with Teresa. Teresa and Aris take Thomas to a cave in the mountains, and make him feel utterly betrayed. Teresa pretends that she had never actually been Thomas’s best friend, and that she loves Aris instead. Feeling terrible, Thomas succumbs to a strange gas in the cave. When he wakes up, he feels fine. Teresa and Aris tell him that they were acting all along, only trying to make him feel betrayed. These were commands from WICKED. Thomas is unable to truly trust Teresa anymore.
All of the groups converge down in the desert below, on the other side of the mountains. A flag in the sand denotes a supposed “Safe Haven.” However, giant chambers of monsters arrive, and Thomas and his friends have to fight them off. During this mess, a storm also starts, and a WICKED Berg arrives as well. Everybody clambers aboard the aircraft. One of the WICKED personnel says that they can only save either Jorge or Brenda, who are civilians. Thomas pretends to choose Jorge, but then knocks out the man and insists that both civilians get to stay. Thomas and his friends go to rest, and then Thomas is taken away and separated again. The book ends with a letter from Ava Paige, the Chancellor, to her associates, saying that deliberations are underway. WICKED is currently figuring out who is really immune to the Flare and who is not.