Pain with intercourse?

The first time my boyfriend and I had sex, it was painful but bearable. Shortly after, I started spotting a little bit. We had sex again a couple days later, but it was so painful with this burning sensation that we couldn’t continue and I started bleeding again afterwards. I went to the doctor and got tested for STDs but the tests were negative. My doctor then prescribed me a pill for a yeast infection. It’s been a week since I took the pill and although my doctor never said it was 100% a yeast infection, I had some symptoms like itching that went away. We had sex again today and it hurt again, but not as bad as last time. I’m also bleeding a tiny bit again. Any ideas why?