Linear topologies arise naturally in the context of Internet-of-Things (IoT) applications for smart cities, where the infrastructure itself commonly has a linear or semi-linear structure. This is the case of buildings, public transportation systems, road infrastructure, and utility distribution networks. Given the prevalence of this type of topologies, several Medium Access Control (MAC) protocols have been designed to take advantage of their particular properties. Unfortunately, most of them do not scale well as the node density and the distance in hops to the sink increases. The result is that packets generated a few hops away from the sink tend to experience unacceptable high end-to-end delay and low delivery probabilities. This paper introduces HP-MAC, a synchronized duty-cycled MAC protocol for Linear Sensor Networks (LSNs) that implements distributed elections based on hash functions that assign transmission priorities to nodes to avoid collisions. HP-MAC also implements a packet queuing scheme that acts as a mechanism to control the amount of network resources allocated to data flows generated at different grades. This way, packets generated many hops away from the sink can reach their destination with similar loss probability and end-to-end delay to that of packets generated by nodes located close to the sink.We use a Discrete-Time Markov Chain (DTMC) to model the performance of the proposed protocol. Numerical solutions of this model show that HP-MAC outperforms state-of-the-art representatives in terms of throughput, end-to-end delay, power consumption, and packet loss probability. These results are validated through extensive discrete-event simulations.