The chapter's second `תּוֹרָה`. The reading is established at 28:4.
Quick answer
Keeping the teaching shows up as discernment; the company you keep shows up on your father. The verse measures a son by two visible things.
Read both lines
The first line makes torah-keeping and discernment the same thing rather than cause and effect, which fits the chapter's earlier claim that abandoning instruction ruins your judgment about people. The second line then jumps to companions, and the connection is the book's usual one: what a man keeps and who he keeps are the same evidence.
Gluttons is the word the father used at 23:20–21 when warning about drunkards and gluttons, so the son in view has landed exactly where that lecture said not to. And the consequence lands on the father, publicly, which is the same exposure 27:11 admitted from the father's side.
Related: Proverbs 28:4 · Proverbs 23:20–21 · Proverbs 27:11 · Proverbs 13:20
New King James Version®, Copyright © 1982, Thomas Nelson. All rights reserved. Full copyright information. Scripture provided by API.Bible.
Go Deeper
If this verse has been used to put weight on you that it was never carrying, ask about it directly.