If you want to see the Amalfi Coast, actually staying on it is invaluable. The crowds on the AC are mostly day-trippers coming from Sorrento, Salerno, Naples, et al. So, midday to evening is generally crushed and not the best sightseeing. By staying on the coast, you avoid a lot of this. When you’re traveling between towns, you’re generally moving in the opposite direction. Even a busy town like Amalfi is downright peaceful in the morning. As far as which town: Amalfi is THE transportation hub on the coast, and as such is very handy. Ravello is an easy 15min bus ride away. The smaller towns might have a little more romance and lighter crowds, but with just a few days I would go for the convenient transport option. I stayed in Atrani, a somewhat nervy but short walk up the road (literally on the road) from Amalfi. Had the convenience of Amalfi town, but the local town feeling. Atrani also has a public sand beach.
For all the Bay of Naples sights, you’ll want to base in either Sorrento or Naples. The sightseeing logistics are about the same, since in this scenario you’re not day tripping to the AC. There’s no advantage to splitting these up. For you, Naples seems the clear choice, especially if you’re planning on Paestum. Sorrento gets love for its logistical convenience and calm demeanor, but it’s not really a destination in of itself. Naples is gritty and wild and fun in that way. I think you’ll enjoy it.
So, I think 4 nights Naples, 3 nights Amalfi (whichever coast town) would be ideal.
Capri is a great day trip, and Naples or Amalfi would be decent places to fit it into your itinerary. Do your best to avoid the crowds by grabbing the earliest ferries, skip Capri Town for Anacapri. I found the boat ride around Capri to be fun and a decent value, didn’t do the grotto.