Hi, welcome to the ehealth forum and I am glad to help you.
You seem concerned by the risk of contacting HIV on exposure to the secretions(semen) of the friend who is a known case of HIV.
The first thing is that you should always take precautions and avoid high risk sexual exposure. Since now you seem to be exposed and there is definite risk though it is not sure that you will become infected as the same can be ascertained only on HIV testing which is offered as a standard at 3 months post exposure.
You can discuss the same with your doctor and the HIV counsellor who can also arrange for a rapid diagnosis with some tests that are positive earlier than 3 months of high risk exposure and the role of drugs for post exposure prophylaxis can be discussed at the same time.
Hope this helps. Take care.
Note: This post is not to emphasise final diagnosis as the same cannot be made online and is aimed just to provide medical information and no treatment suggested above be taken without face to face consultation with health care professional.