All HDMI audio signals get downgraded to 2-channel when passed through a TV to the TV's optical out.
For best multichannel sound, connect all of the HDMI (and other video/audio) cables directly to your receiver. If you use a cable box or satellite decoder box, connect that to the receiver, too. If your channel selection is being done by the TV, then you also need to connect the TV's optical (or other) audio output to the receiver. (The TV's own audio is not downgraded.)
Connect the receiver's HDMI output to your TV. The HDMI video will be passed through your receiver to the TV. Instead of selecting the appropriate input device on the TV, select it on the receiver.
Turn off the TV's internal speakers: all of the sound will be generated by your receiver and the speakers that are connected to it. The external speaker system will sound much better than the speakers in the TV. (Some people use the TV's speakers as the center channel, but most don't like it.)
If you have more HDMI connections than your receiver has HDMI inputs, then you need to consider upgrading your receiver. (Or you can use their non-HDMI connections.) If you have devices connected to the receiver which do not use HDMI, then you might need to connect the corresponding receiver outputs to your TV, too. Many mid-range receivers do not translate non-HDMI signals to HDMI, although the more expensive models do.