With the development of internet of things (IoT) technology, servitization of IoT device functions has become a trend. The cooperation between IoT devices can be equivalent to web service composition. However, current service composition approaches applied in the internet cannot work well in IoT environments due to weak adaptability, low accuracy, and poor time performance. This paper, based on service dependency graph, proposes a top-k QoS-optimal service composition approach suitable for IoT. It aims to construct the relationship between services by applying the service dependency model and to reduce the traversal space through effective filtering strategies. On the basis of a composition path traversal sequence, the generated service composition can be represented directly to avoid backtracking search. Meanwhile, the redundant services can be removed from the service composition with the help of dynamic programming. Experiments show that the approach can obtain the top-k QoS-optimal service composition and better time performance.