A sublease without the landlord's permission in violation of the lease is cause for eviction on three-day's notice. If the landlord accepted rent from you knowing you were there, he probably waived the lease violation. Otherwise, you better start looking for a new place to live, probably with roommates.
There are some restrictions on evicting tenants for subletting units in San Francisco covered by the Rent Ordinance. However, they don't appear to apply in your situation. You might have other defenses or you might be able to work something out with the landlord. If the unit is covered by the Rent Ordinance, though, the landlord has a financial incentive to create a new tenancy. If the landlord has already served the 3-day notice, you should try and find an attorney.
I am NOT giving you legal advice. Nothing stated here should be construed to establish any sort of attorney-client relationship. My opinion stated here is limited by the information available to me. You should not rely on my statements in determining your course of action.