I guess no matter what your decision will be, your boss will have no choice but to accept it.
For me, the best way is just to formally send your boss a resignation letter and talk to him/her prior to that. Be sure to express gratitude and as much as you want to keep working, you have decided to leave because this is what you really want.
When I was working then, my boss wouldn't also allow me to leave. She even offered me to work at home but I politely refused. I just told her that I really need to focus on my pregnancy and I thanked her for all the opportunities, learning and experiences I've had in her company. And she did. Now, I'm a happy work-at-home mama and I love it!