It's not just AIDS. Homosexuals incubate MRSA, which can then spread to the general population. So unlike smoking, banning gay sex is actually justified for public health reasons.
Casual contact with skin passes MRSA. You wouldn't have heterosexual sex with someone who had MRSA, would you?
Banning smoking would save as many lives as banning gay sex. If only public health reasons mattered, such bans could be justified. But other considerations enter in with respect to both smoking and sex.
I don't think that banning gay sex could be justified even if the desire to prevent the spread of disease were to be accepted as being so important that it takes precedence over all other concerns, such as human rights. Unless you have some way to observe all people all the time, you really cannot prevent people from having gay sex (or any kind of sex). You might be able to prevent it in public washrooms, but not in people's bedrooms. It is also well to remember, as gay activists have often had to point out, that AIDS is caused by a virus, not by homosexuality. And there are perfectly safe ways to have gay sex even with a partner who is HIV positive. Not all gay sex consists of anal intercourse, and even anal intercourse, if you do it really carefully with condoms, does not necessarily transmit disease (although it is still likely to result in hemorrhoids if you do too much of it). And heterosexual sex also transmits HIV (particularly from men to women; it does not transmit as readily from female to male, although that also happens to some extent). The epidemic of HIV in Africa is believed to result largely from heterosexual sex, not gay sex.
Given the failure to eradicate the smoking of marijuana, I also have to doubt that the smoking of tobacco could be completely eradicated, even if it were to be made illegal. However, it is much easier to grow marijuana than tobacco, so there is SOME possibility that a smoking ban, if such a thing were to be introduced, could be effective. And particularly if alternative forms of nicotine, such as nicotine chewing gum, were to remain legal while smoking becomes illegal, we might be able to actually bring an end to smoking. Whether this would be an acceptable public health measure, or an unacceptable infringement on the human rights of smokers, could be debated, but I personally think that it would be justifiable. Smokers, as you have already pointed out, harm others as well as themselves, by means of second-hand smoke, so it is a particularly objectionable form of drug addiction. In general, I think that people should legally have the right to endanger their own health if they so desire - you are the owner of your own life - but they do not have the right to endanger other people's health. That should be the basic principle for any drug legislation.
Sex, even when it does harm people's health, remains a consensual activity except in the case of rape, and rape is of course already illegal. The other problem with sex is non-disclosure. I do think that it should be a serious crime to have sex with someone without advising them of an existing medical risk that you know about, particularly if you are HIV positive. Still, it is wise to always take suitable precautions. Your partner may be HIV positive without even knowing it, and we can't disclose what we do not know. Sex is very dangerous these days. Of course, so is driving a car, and few people advocate banning cars. I think that we all do need to take a certain amount of risk in our lives, there is no practical way to live a totally safe life. But we also need to be careful in choosing the risks that we take.
I don't think banning gay sex makes any sense either, and I have already said that I don't think banning cigarette smoking makes any sense either. If I support euthanasia for people who request it, I can't call for banning cigarettes. I can only call for keeping it out of my face and my lungs.
I have already argued that key to public health problems caused by risky behaviours (which I have also said include heterosexual sex outside of monogamous relationship) would be awareness of dangers and effort to make sure we don't harm others to best of our ability.