Is there anything I can do to prevent STDs after having unprotected sex?
You can certainly do your best to help keep your immune system doing it's job to fight off anything you may have been exposed to, just by taking sound care of yourself: eating right, getting enough activity and rest, limiting or avoiding substances that can tax the immune system like caffeine, recreational drugs or alcohol. You can also be sure you're up to date with your vaccinations, specifically your Hepatitis vaccines.
Treatments like Post Exposure Prophylaxis (PEP) are sometimes available for people who have knowingly or very likely been exposed to HIV specifically, such as crisis or healthcare workers or sexual assault victims, and again, people who have been exposed to blood directly and are certain or relatively certain that blood belonged to an HIV-positive person. Many areas offer PEP to folks who have been exposed to HIV through sex , such as folks who experienced a condom breaking or who had condomless sex without planning to. That kind of preventative treatment is something a person would need to start right away, as well. There are prophylaxis also available for exposure to Chlamydia or Gonorrhea (a course of antibiotics), and also prophylaxis for preventing Hepatitis B. Again, though, those possibly preventative treatments do need to be started immediately to be effective, and often do not tend to be available to the general public. But you could certainly ask your healthcare provider about them if you liked.
STI prevention is something that really just needs to happen at the time of sex, by being sure to use latex barriers for, ideally, vaginal, anal or oral sex , and with handwashing for manual sex . You can make it easier for you to do that by just keeping condoms around as a habit if you're sexually active , and getting in the easy habit of putting one on anytime you're going to have genital contact with a partner . It should also be mentioned, too, that if your partners can become pregnant, and you don't want to be a Daddy, slipping on a condom does double-duty in that regard.
Regular screenings are also an important part of safer sex practice: they don't prevent STIs, but they can identify them early so that a person can get treated. Many STIs are easily treatable -- especially when identified early -- and it's important to get treated for your own health and the public health if you do contract one. Even with those which cannot be cured or treated, simply knowing you have an STI is important so that you can make sound choices with sexual behavior and inform new partners of any potential risks they may be taking.
Since it sounds like you have recently had a risk, you'll want to schedule a screening for yourself soon, then just get in the habit of getting those at least once a year, more often if you're switching partners more frequently than that. People who are using latex barriers also still need those screenings: latex barriers will drastically reduce risks of STIs, but transmission is still possible.
Here are a few extra links for you about sexually transmitted infections , testing and prevention as well as condom use: