According to the timetables I could dig up via RailEurope, you'd have to get up a bit earlier
Bari Centrale 8:04a -> Taranto 9:14a (1h10m)
Taranto 10:05a -> Naples 2:42p (4h37m)
Total time: 5h47m
If you want to leave later, you could do the following route, but the total time is pretty crazy:
Bari Centrale 9:03a -> Foggia 10:05a (1h02m)
Foggia 11:17a -> Potenza Inferiore 1:35p (2h18m)
Potenza Inferiore 2:20p -> Naples 5:19p (2h59m)
Total time: 6h19m
It should cost you under $50 US for that leg.
From Naples, there's a train every half hour to Sorrento. It takes about one hour.