Upvote:1
You appear to be confusing two separate things.
You are covered entirely by point 1: you will be in the USA for less than 90 days, then you will leave and not come back. You can stay in Canada for as long as Canada will allow you to and the USA doesn't care, as long as you don't go back to the USA without leaving North America first. (And you don't plan to do that: you plan to return home after visiting Canada.)
Point 2 says that you cannot spend three weeks in the USA, then spend three months in Canada, and then go back to the USA. The USA treats that as a continuation of your first visit, which would make it longer than 120+ days. Since you're not planning to do this, it doesn't affect you.
Coincidentally, the US Customs and Border Patrol website (the same page I linked above) specifically uses Costa Rica as an example. If you did fly to Costa Rica, that would reset the clock and your return to the USA would count as a separate visit. However, US immigration is very sensitive about people trying to game the system by spending 90 days in the USA, leaving briefly and then trying to return.
Upvote:2
I wanted to enter USA under VWP stay there for about 3 weeks, cross over to CAN where I would stay for 3-3.5 more months and then return back to country of residence from CAN.
If you follow the above plan, then you will not overstay your stay in the USA under the VWP. The USA would consider you "in" the country for only your initial 3 weeks. As long as you are eligible for the VWP, you do not need a tourist visa.
You would only encounter a problem if you tried to re-enter the USA after your 3+ month stay in Canada. In this case, your entry to Canada would not reset the VWP 90-day clock.