Oh boy! What sounds like a fairly simple question has a bunch of complications. I’m inclined to say that your 2nd alternative seems preferable; i.e., Amtrak Sac to Sf, then taxi/lyft/uber to SFO. My reasons are:
4th & Townshend is not close to the Powell St. Bart station several (?) blocks. Though, if you don’t mind hauling your bags along city streets, that may be the plan for you.
As far as I know, you can no longer buy single ride Bart tickets. You would have to buy a ticket with a large value for each of you.. (I have a clipper card, which refills automatically, so I don’t know the details.)
I would look into pre-reserving the SF to airport segment, though I’ve heard that option with uber is not terribly reliable. There are still some shared van services, but not to where I live, so I can’t give details.
I hope you are planning to sleep near SFO the night before your flight. I would never take a chance that nothing will go wrong with such a lengthy journey.