Can overdosing on sleeping pills affect a person mentally after he recovers?

Yes. There can be lasting effects to some of the medications themselves or side effects from being induced into a deeper than usual sleep state.