First, establish clear boundaries in your relationship with your partner about what is acceptable and unacceptable in terms of sexual and relationship exploration. Also, maintain a healthy and platonic relationship with your best friend. Don't engage in overly flirtatious or sexually charged conversations with either of them in a way that could lead to such an idea.
You can start by being very clear in your own mind about your relationship ideals. Then, share these with your partner early on in the relationship. For your best friend, always act in a way that emphasizes the platonic nature of your friendship. If there are any signs of an inappropriate idea starting to form, whether it's a comment or a certain look, nip it in the bud immediately. Reinforce the importance of the existing relationships as they are and don't let any outside influences or curiosities disrupt them.
Well, communication is key. Have an open conversation with your partner about your relationship values and that you don't want any form of non - traditional relationship dynamics. With your best friend, keep the friendship strictly friendly. Avoid situations where alcohol or drugs could cloud judgment and lead to inappropriate discussions. Also, focus on building a strong, monogamous relationship with your partner based on mutual respect and trust.