Thanks for using ask a doctors service from doctors spring .i understand your problem and will try to answer your query as best possible.
The pain you experienced during sex is called dyspareunia which could be superficial or deep. In Superficial dyspareunia, it occurs when penetration is attempted and the lesion is to be expected at or near the entrance of vagina (introitus). This could be due to vaginal dryness, spasm of the sphincter vagina and the muscles (also known as vaginismus), Skin Bridge, lichen sclerosus. In deep dyspareunia, it occurs after penetration and it is usually deeper seated like vaginal trauma.
I would recommend you to use a lubricant during sex and follow it after with a vaginal douche used twice a day. Use can also consult your obg-gyn doctor who can run you through a few tests and find out the cause for it.
Hope this helps, if there is any further queries do let me know.