I had the same issue but found the conversation here confusing, it still took me a long time to figure out the solution. I'll therefore try to sum it up.
I have MS Word 2010.
Let's stick to the Original Poster's first screenshot, where the second line in the second-level table-of-content ("TOC") heading is not indented and the page number is not right-aligned. In my understanding, the solution is to set the indentation of a second-level TOC-heading to "Hanging" and set the hanging value equal to physical length of the string "1.2\tab". The indentation then somehow forces the page number to jump off to the right margin where it belongs. Obviously, this has to be done for each heading level separately since e.g. a fourth-level heading "126.96.36.199.\tab" will have a greater physical length.
Step by step:
- go to ribbon "References", click "TOC" and then "Insert TOC" at the bottom
- in the opened dialogue box, hit "Modify"
- in the next open dialogue box, select the desired TOC level, and hit "Modify"
- in the new dialogue box, click the "Format" drop-down menu at the bottom, and select "Paragraph"
- finally, in this new dialog box see the "Indentation" section, and in the "Special" drop-down select "Hanging" and insert the appropriate value in the "By" field. You'll have to find the optimal value by experimenting, my guess is it will most often be 1 - 2 cm.
- close (hit "OK") in all the open dialog boxes and at the end, when You're asked whether to replace the existing TOC with a new one, click "Yes".
I don't guarantee this is 100% correct but so far, it seems to be working for me.