Lifestyle, sexual history, and medical history characteristics were analyzed as risk factors for non-Hodgkin's lymphoma (NHL) in a population-based case-control study of 1593 subjects with NHL and 2515 control subjects conducted in the San Francisco Bay Area between 1988 and 1995. The results for homosexual men, 312 with NHL and 420 control subjects, showed that HIV infection was associated with a 20-fold increased risk for NHL. Among HIV-positive homosexual men, after adjustment for other factors, those that were associated with a reduced risk for NHL were frequency of receptive anal intercourse between the ages of 20 and 29 (1 to 9 times: OR = 0.63; > or = 10 times: OR = 0.37; trend: p = 0.02), allergy to grass, hay, leaves, plants and pollen (OR = 0.35, CI = 0.19 to 0.64), number of bee or wasp stings (1 to 3 times: OR = 0.65; > or =4 times: OR = 0.56; trend: p = 0.07), use of Tagamet (cimetidine) for 4 consecutive weeks or longer (OR = 0.39, CI = 0.17 to 0.89), vaccination against influenza (OR = 0.41, CI = 0.23 to 0.74), and lifetime frequency of amphetamine use (1 to 19 times: OR = 0.59; > or =20 times: OR = 0.38; trend: p = 0.003). Among HIV-negative homosexual men, after adjustment for other factors, factors that were associated with NHL status were frequency of receptive anal intercourse between the ages of 20 and 29 (1 to 9 times: OR = 0.39; > or =10 times: OR = 0.20; trend: p = 0.001), nonmedication allergies (OR = 0.43, CI = 0.21 to 0.89), vaccination against poliomyelitis at <10 years (OR = 0.41, CI = 0.17 to 0.99), and having five or more siblings (OR = 3.6, CI = 1.7 to 7.7). An increased immunosuppressive effect of seminal fluid on sensitive rectal tissue and support from earlier work suggesting that HIV-related lymphomas may be outgrowths of antigen-driven B cells provide a possible mechanism for the results of this study. The role of allergic reactions in NHL is likely to be complex and may be related to B-cell differentiation. These associations may provide insight into an antigen-driven process early in lymphomagenesis.