The conflict in Roald Dahl's young reader's novel The BFG is resolved when Sophie devises a plan to inform the Queen of England of the problem concerning flesh-eating giants. Sophie's plan involves mixing dreams to give the Queen of England her own personalized nightmare. The nightmare is about giants snatching up school children to eat. Sophie's plan also involves her sitting on the queen's windowsill so that, when the curtains are drawn back in the morning, Sophie is there to tell the queen the dream is actually real. The third part of the plan involves the BFG hiding on the palace grounds so that he can prove the existence of giants at the appropriate moment.
All parts of Sophie's plan are successful, and the queen even invites Sophie and the BFG to have breakfast with her in the ballroom. Once she is able to confirm the BFG's story, she calls for the "Head of the Army and the Head of the Air Force" to plan the giants' capture, which is also according to Sophie's plan. The story ends with the mission to capture the giants being successful: All flesh-eating giants are imprisoned in a deep pit. In addition, the queen has a large house built for the BFG and a cottage built for Sophie. Sophie remains with the BFG, who becomes her new adoptive family member.