The unprecedented astrometry from Gaia DR2 provides us with an opportunity to study in detail molecular clouds in the solar neighbourhood. Extracting the wealth of information in these data remains a challenge, however. We have further improved our Gaussian Processes-based, three-dimensional dust mapping technique to allow us to study molecular clouds in more detail. These improvements include a significantly better scaling of the computational cost with the number of stars, and taking into account distance uncertainties to individual stars. Using Gaia DR2 astrometry together with 2MASS and WISE photometry for 30 000 stars, we infer the distribution of dust out to 600 pc in the direction of the Orion A molecular cloud. We identify a bubble-like structure in front of Orion A, centred at a distance of about 350 pc from the Sun. The main Orion A structure is visible at slightly larger distances, and we clearly see a tail extending over 100 pc that is curved and slightly inclined to the line-of-sight. The location of our foreground structure coincides with 5-10 Myr old stellar populations, suggesting a star formation episode that predates that of the Orion Nebula Cluster itself. We identify also the main structure of the Orion B molecular cloud, and in addition discover a background component to this at a distance of about 460 pc from the Sun. Finally, we associate our dust components at different distances with the plane-of-the-sky magnetic field orientation as mapped by Planck. This provides valuable information for modelling the magnetic field in 3D around star forming regions.