The traditional answer would be that you represent speech with a speech balloon and thoughts with a thought bubble. In classic American comics these two objects typically have visually distinct styles.
For example:

Text like, "Crowd's lining the sidewalk...", "Wait-- ooph?!", "The plaque..." are all meant to be thoughts. Compare the shape of the wavy-sided white box with the smoothly curved sides of the boxes around the speech, "Lois?" and "I've been waiting for you!" in the last panel (bottom right).
HOWEVER
Thought balloons have gone out of style. That example posted above is from a comic published in 1992. This was toward the end of the period in which thought balloons were common in mainstream comics. More recently, thought balloons have been replaced by text boxes. Here's a nice article about this: "From Bubbles To Boxes: The Shift From Thought Balloons To First-Person Captions"
For example:

This is from a comic published in 2014. Spider-Man's interior monologue is represented by straight-sided boxes, which are styled similarly to editor's notes, or narration. Sometimes, as in the Spider-Man example, these inner thought text boxes can be styled slightly differently than a normal text box to make it more obvious they belong to a character rather than a narrator or editor.
Notice how the first text box ("Yes!") has part of the Spider-Man logo on the corner and all of these text boxes have a red border reminiscent of the red in Spider-Man's suit.
As to representing someone else's words going through a character's mind, you can combine something you see in each example. Note in the first example that the yellow text box in the top-left panel contains quotation marks. This indicates "off-camera" speech. If you put quotation marks in an inner monologue text box, this can show that the character is thinking about someone else's words.