They affect the outcome of the story tremendously. More specifically, they affect the middle of the play through their mischief, providing much of the humor through Bottom's transformations and the confusion and plight of the four young lovers.
This sets up the audience for the happy ending, and so affects the outcome for readers. For those inside the story, they affect the ending in two major ways. First, the lovers who were lost and at odds are now together (especially Helena and Demetrius). Second, and more subtly, the entire natural world is out of alignment because Titania and Oberon were feuding. Since they get together again at the play's end, things will go into their proper alignment and run smoothly.