Hmm, I wonder too. If the A340 is, as you claim, "much better suited for trans-Pacific routes" and "better comfort", then WHY would airlines much rather order the 777?
Airlines order whatever suits them best. For example, Eva Air ordered the A330 over the 767 because the A330 is superior to the 767. Instead of ordering A340 along with A330 (as you would expect, since A330 and A340 have commonality), however, they went with the 777-200LR/-300ER. The fact that they went with 2 different fleet types, despite the extra costs and training, means that they thought the 777 was a better candidate than the A340, good enough to make up for the increased costs.
And please stop perpetrating the myth that 4 engines/ETOPS-free is better suited. It is extremely ignorant (just like Airbus' "4 engines 4 long haul" campaign, which has already been heaviliy criticized by engine manufactuers and industry organizations for suggesting that the 777 is not safe). Industry experts know that that is not true and it is merely an attempt to try and gain more A340 sales. Airbus itself was a supporter of ETOPS in the early '90s.