Think your company has what it takes to make our Top Company Cultures list? Apply now.

Employees spend so much of their day at work, it’s inevitable they’ll eventually begin to think of a few coworkers as friends. They may even go to lunch with their fellow employees or head to happy hour after work. Over time, they may even forge strong friendships that rival relationships they have outside of the office.

While few employers would begrudge friendly interactions among coworkers, an employee can be judged for personal friendships. As unfair as it may seem, you may be “guilty by association” if you’re seen as spending excessive time with the wrong people. Alternatively, you may be seen as a poor team player if you avoid fraternizing with coworkers altogether. Here are a few tips to help you enjoy healthy work friendships without jeopardizing your career.

Pay Attention

Most often the issue isn’t the fact that you’ve made personal friendships in the office. The issue is primarily with the people you’ve chosen. Pay close attention to how your coworkers are being perceived by upper management. If your lunch buddy is the office gossip, you may deal with collateral damage, especially if things you say in confidence are repeated. Your concerns shouldn’t be limited to coworkers, either. If you spend happy hour with friends at a competing company, your superiors may eventually see you as a risk to the information they work so hard to keep confidential.

Keep work at work

If you do choose to leave the office with coworkers, try not to take your work with you. This is important because it will give you a chance to truly take a break from the stresses of the office. Most importantly, though, it keeps you from venting about your daily frustrations. While it may feel good in the moment, complaining is not only contagious but also bad for your health. Instead, make a pact to steer clear of work talk and focus on other topics.

Avoid alcohol

This may be difficult if happy hour is your coworkers’ favorite social option, but it’s best to keep large amounts of alcohol at a minimum. One or two drinks can sometimes be the perfect way to break the ice but beyond that, you can easily get into trouble. You may find that you open up too much about your frustrations, giving your coworkers more information than you would have otherwise. Now that everyone is armed with a smartphone, you may also find that there is lingering photographic evidence of your night out, with your alcoholic beverage possibly sending the wrong message.

Stay professional at work

One of the biggest downfalls to work friendships is that it can be hard to resist the urge to stop by each other’s desks for a quick chat. When you’re at work, it’s generally important that your boss see you as someone who works hard from the start of the workday to the end. Cultivate good work habits that leave little time for idle chitchat, and stay at your desk as much as possible throughout the day.

If coworkers make a habit of stopping by your cubicle, there are things you can do to send a clear signal that you’re busy. Wear headphones, even if nothing is playing through them. If you know someone will stop by when passing through, pick up the phone and pretend to be involved in conversation. If all else fails, find a quiet place where you can work and no one will know where to find you.

Work friendships can be an effective avenue for injecting fun into an ordinary workweek. As long as you learn to separate business from your personal interactions, you can enjoy a lunchtime getaway, a happy hour get-together, and a weekend dinner with coworkers without harming your career.