The rheology of bubble-bearing magmas is investigated through a series of three-dimensional boundary integral calculations in which the effects of bubble deformation, volume fraction, and strain rate are considered. The behaviour of bubbles in viscous flows is characterized by the capillary number, Ca, the ratio of viscous stresses that promote deformation to surface tension stresses that resist deformation. Estimates of Ca in natural flows are highly variable, reflecting variations in strain rate and melt viscosity. In the low capillary number limit (e.g., in carbonatite flows) bubbles remain spherical and may contribute greater stress to the suspension than in high capillary number flows, in which bubble deformation is significant. At higher capillary numbers, deformed bubbles become aligned in the direction of flow, and as a result, contribute less stress to the suspension. Calculations indicate that the effective viscosity of bubbly suspensions, at least for Ca<0.5, is a weakly increasing function of volume fraction and that suspensions of bubbles are shear thinning. Bubbles reach their quasi-steady deformed shapes after strains of order one; for shorter times, the continuous deformation of the bubbles results in continual changes of rheological properties. In particular, for small strains, the effective viscosity of the suspension may be less than that of the liquid phase. Results of this study may help explain previous experimental, theoretical, and field based observations regarding the effects of bubbles on flow rheology.