Structured illumination microscopy is a recent imaging technique that aims at going beyond the classical optical resolution by reconstructing high-resolution (HR) images from low-resolution (LR) images acquired through modulation of the transfer function of the microscope. The classical implementation has a number of drawbacks, such as requiring a large number of images to be acquired and parameters to be manually set in an ad-hoc manner that have, until now, hampered its wide dissemination. Here, we present a new framework based on a Bayesian inverse problem formulation approach that enables the computation of one HR image from a reduced number of LR images and has no specific constraints on the modulation. Moreover, it permits to automatically estimate the optimal reconstruction hyperparameters and to compute an uncertainty bound on the estimated values. We demonstrate through numerical evaluations on simulated data and examples on real microscopy data that our approach represents a decisive advance for a wider use of HR microscopy through structured illumination.