When driving, you tend to put the car where you're looking. If you're in a skid and there's a telephone pole, don't look at the telephone pole, because you'll run into. Look where you want the car to go.
When you feel the thing you're worried about starting to happen, play the sound in your head of someone famous who has the accent you want speaking in a movie or on TV or think of your favorite quote from them or whatever, and play the sound in your head of you saying that same line the way they did. (For example, if it's a UK accent you're after, think of James Bond, being smooth and suave and unflustered no matter what's going on.)
Focus on what you want to sound like, and then relax and let it flow out.
One way to help keep a secret like this is to occasionally use other accents on purpose, whether you're any good at them or not; sometimes do a Schwarzenegger, or your version of W, or whatever, and have some famous names for the accent you're trying to hide at the ready, or ideally famous quotes that work in that accent, and then use it whenever you say that. If you're heading out for a short while, do a Terminator "I'll be back." If you're pretending to be offended, do Queen Victoria's "We are not amused." Then if you do whatever-accent-it-is-you're-trying-to-stop, you can even critique yourself. "Should that have a bit more twang?"
Assuming you're in the States, you can practice a bunch of accents and maybe knowing a lot of them and how they sound different will help you keep your pronunciations under control. https://www.amazon.com/American-Dialects-Manual-Directors-Writers/dp/087830049X
There are instructions about how to get the sound:
https://howtotransatlanticaccent.wordpress.com
Semi-relevantly, I used to know a stage actress who really liked this book: https://www.amazon.com/American-Dialects-Lewis-Herman/dp/087830049X
She would go out for a part and directors would say things like "Well, it's kinda cool that we've got someone who's actually from Boston," or similar, for any number of places her character was supposed to be from. She wouldn't tell them until after that she was just putting on the accent for the role. They were always impressed.