IPhone 4 silent button is being dodgy?

I have my iPhone set to silent, but from time to time it has a spell of alternating between silent and loud even though the button on the side is set to silent then it will be fine, can anyone help me fix this?

That happened to me.
Stop using the button for a while and start to use settings to silence it.
And in a couple of weeks try using it again!
It worked for me.