If you’ve been using Teams for a while, you may feel somewhat frustrated that the amount of “white space” in Teams chat seems to take up a lot space that could be used to display more content without scrolling. Teams now has a Compact setting for chat density that can help that. Here’s how it works…
Here is a normal chat with a lot of white space due to spacing between messages, stacked content in the specific message, and so on:

To change the density setting, click on the ellipsis next to your picture in Teams and select Settings:

In General > Chat density, change your setting from Comfy to Compact:

Now your chat is more compact, with everything right justified:

The only thing I’m not overly thrilled with is that you don’t see the timestamp to the far right unless you hover over the actual chat entry. If that would show up by default, this would be perfect in my opinion.