Hello, and welcome to SI.
Sorry for the circumstances that have brought you here, but I think you'll find a great deal of resources and fellow members to help get you through.
A good place to start is the Healing Library in the upper left hand corner of the screen.
It sounds like you and your BF have both had some recent discoveries of behaviors that are long over with. The hard part of it is, during the time of the discovery, it is like it just happened to each of you.
There are many different types of affairs, all of them with their own pain involved. PA's (Physical Affairs), EA's (Emotional Affairs), ONS's (One Night Stands), LTA's (Long Term Affairs). The list goes on. There are two threads that all of these have in common: 1) The betrayal hurts, and 2) There was some broken thinking that went on with the person who was in the affair.
A book I would highly recommend is Not "Just Friends" by Shirley Glass.
IC (Individual Counseling) is also helpful as is MC/CC (Marriage Counseling or Couples Counseling).
It sounds like you two really love each other, and I hope you can work through things. Keep posting. We're here to support you however you need.