There were seven first-half tries, four of them inside the first16 minutes, three of them to the visitors, at The Rec as Bath suffered a second defeat in three games.
After right wing Ben Redshaw crossed inside the second minute, home hooker Jasper Spandler quickly replied with the first of his two first-half tries in the sixth minute.
But Josiah Edwards-Giraud, Redshaw again and Josh Hathaway all crossed before the break. And, with Ciaran Donoghue only landing one conversion, it was 31-17 to the visitors at the break.
An early second-half Bath revival triggered converted tries for Spandler and Tyler Offiah to briefly draw level, before Harry Taylor’s converted try stretched Gloucester back in front, followed by Ross Byrne’s penalty.
Max Pearce’s late try caused visiting stress at 36-41 – but it went unconverted and Byrne’s 79th-minute penalty closed the door again.