Regularly have conversations about loyalty and respect in the relationship. Make your friends aware of your relationship boundaries as well. For example, avoid situations where your partner and your friend are alone together for extended periods. Build a strong social network where everyone respects each other's relationships and there are consequences for crossing boundaries.
One way is to ensure that you have a strong and healthy relationship with your partner. Spend quality time together, keep the romance alive, and make sure your partner feels satisfied in the relationship. Also, get to know your friends' partners well so there's a sense of community and mutual respect. This can help prevent any inappropriate behavior from emerging.
Set clear boundaries from the start in your relationship. Let your partner know which behaviors are unacceptable when it comes to interacting with your friends. Also, encourage open communication so that if there are any feelings of attraction or discomfort, they can be addressed right away.