Bariatric surgery is highly successful in improving health compared to conventional dietary treatments. It has been suggested that the gut microbiota is a relevant factor in weight loss after bariatric surgery. Considering that bariatric procedures cause different rearrangements of the digestive tract, they probably have different effects on the gut microbiota. In this study, we compared the impact of medical treatment, sleeve gastrectomy and Roux-en-Y gastric bypass on the gut microbiota from obese subjects. Anthropometric and clinical parameters were registered before, 6 and 12 months after treatment. Fecal samples were collected and microbiota composition was studied before and six months post treatment using 16S rRNA gene sequencing and qPCR. In comparison to dietary treatment, changes in intestinal microbiota were more pronounced in patients subjected to surgery, observing a bloom in Proteobacteria. Interestingly, Bacteroidetes abundance was largely different after six months of each surgical procedure. Furthermore, changes in weight and BMI, or glucose metabolism, correlated positively with changes in these two phyla in these surgical procedures. These results indicate that distinct surgical procedures alter the gut microbiota differently, and changes in gut microbiota might contribute to health improvement. This study contributes to our understanding of the impact of weight loss surgery on the gut microbiota, and could be used to replicate this effect using targeted therapies.