The easiest and best option for you is to find a new job. The other option, which I don't recommend, is to stay at the job and have a talk with your boss. The talk would have to include something on the lines that what happened between you two was a mistake and will go no further. You'd like to keep your job and would like that any communications between you two are of a professional manner only.
I truthfully do not think it's a smart move to continue working for this guy as there is definitely some tension that I think will be hard to overcome.
I will assume your husband does not know about this affair. My next question to you is, why did it happen? What is bothering you about your relationship with your husband that you sought affection/attention from your boss? I think in order for this (the affair) not to happen at another place of employment, you need to really look inside yourself to find some answers. I would even suggest trying individual counseling, as it may take some time to get to the root of the problem.