The dynamic nature of opportunistic networks results in long delays, low rates of success for deliveries, etc. As such user experience is limited, and the further development of opportunistic networks is constrained. This paper proposes a prediction-based routing method for opportunistic networks (PB-OppNet). Firstly, using an ARIMA model, PB-OppNet describes the historical contact information between a node pair as a time series to predict the average encounter time interval of the node pair. Secondly, using an optimal stopping rule, PB-OppNet obtains a threshold for encounter time intervals as forwarding utility. Based on this threshold, a node can easily make decisions of stopping observing, or delivering messages when potential forwarding nodes enter its communication range. It can also report different encounter time intervals to the destination node. With the threshold, PB-OppNet can achieve a better compromise of forwarding utility and waiting delay, so that delivery delay is minimized. The simulation experiment result presented here shows that PB-OppNet is better than existing methods in prediction accuracy for links, delivery delays, delivery success rates, etc.