Thanks for your question on Health Care Magic.
I can understand your concern.
No H. Pylori infection is not due to anal sex.
Actually it doesn't not affect all individuals but certain people with high acidity,
GERD (
gastroesophageal reflux disease) are affected more.
It is actually chronic infection.
Long course of treatment is required.
Usually three antibiotics are given for 14-21 days.
But lifestyle modifications and
proton pump inhibitors are required for long time.
Lifestyle modifications like avoidance of
stress, tension, hot and spicy food, large meals,
smoking and alcohol (if you have these habits) etc are needed.
So follow these lifestyle modifications and drugs.
You will mostly improve.
Hope I have solved your query.
I will be happy to help you further. Wish you good health. Thanks.