H1b transfer is your new H1b. Once you get your H1b in America, there is not so called new H1b. You can transfer your H1b any time, but in the I-129 will be filed a start time and end time. The time which you put in the 129 will decide when will you need to start your new job.
2. During the gap between June and August, can I stay in the US? Is their any grace period after leaving my current job?
Actually, your h1b will be expired 10 days later after you lay off or stop working for your old boss. However, you will have acumulate 180 days to stay in America for adjust your status. For you is ok becasue there is only two months to stay.
3. What will happen if my boss layoff me before I got new h1b (after I got a new job offer)? What should I do to keep my status?
Going back to F visa is a good choice.