The usual dose of Viagra is taken 1 hour before sex, preferably on an empty stomach or after a light meal. The effect of the pill may last up to 4 hours. This means that an erection may happen up to 4 hours after taking the pill. It does not mean that the erection will last for 4 hours.