Your question can't be answered without knowing the month and the day of the week, and whether there is a firm deadline, like an international flight or opera ticket, in Rome. In general, transportation on the Amalfi Coast is slower and less-reliable (in terms of having to wait for space on the following bus) than, say, taking the Circumvesuviana transit train to the Naples Centrale station. A really ambitious (and too far, from my point of view) is to aim for the Salerno train station after an exhaustive day on the A.C. Since Sorrento is not really about beaches, many people staying in Sorrento choose (as we did) to take a daytrip to the A.C. during the stay in Sorrento. That's an especially good idea if you have a budget accommodation with perhaps, less view and less breeze, in Sorrento.
If you are going to combine something with the trip to Rome, it might be better to pick a single, well-defined attraction that is directly on the route, which has luggage checking. I'm talking about, for instance, Pompeii. But we also did Pompeii as a leisurely daytrip from Sorrento. These are among the advantages of staying in Sorrento. We bought the high-speed train from Naples to Rome in advance, on the TrenItalia website. We were not permitted (as you might expect) to take the earlier train without extra charge, when we happened to get to Naples Centrale early. So we sat on a bench for an hour.
You might wish to search this newsboard for posts that include both "Sorrento" and "Rome".