N.L.
Oh dear please stop spanking you daughter! I'm really not saying that to be mean and if you were my best friend I would say the same thing. I seriously doubt your daughter is purposely misbehaving. Is she overtired, did she get enough to eat, did you wind things down before taking her to bed like turning off any noise, lights, do you all have a routine like massage, reading, singing quietly, giving her a "10" minute warning that bedtime is coming near, talking about your day or just cuddling??
Spanking, punishing, time outs...those are all things that will just escalate the problem.
It's good that your boyfriend is removing himself from this but if you both approach this is a loving and caring manner, maybe she will respond better to it. I would have a heart to heart with my teenage daughter before bed; not my 4 y/o. Meaning, bring yourself down to her age level per se and think about what your little girl would respond to like soft music or telling a funny little story.