Am I doing the right thing?

I just told my boyfriend that I had been feeling guilty for having sex due to my position with God.

I'm trying to become closer to God. I know I'm not perfect, but I'm making steps.

So when I told my boyfriend this, he automatically was okay with it, and said we won't have sex until we get married. It was shocking to me because he's not religious (anymore). But I feel somewhat bad for making him give up something like that (because, ya know, he's a guy).

Am I being selfish? Am I doing the right thing?