Be aware some airlines frown upon people taking multiple-leg flights just for the sake of racking up mileage or segments, though I've yet to see any of 'em crack the whip yet.
Here's an excerpt from Delta's Skymiles program rules (emphasis on original):
Calculation Of Mileage
Mileage will be calculated between the origin and final destination. On nonstop and multiple-stop through-flights, mileage will be credited from origin to destination. On connecting flights which require a change of plane and flight number, credit is given for each segment of the trip. Voluntary plane changes in lieu of nonstop and/or direct flights for the accumulation of additional mileage or segments are not permitted. Delta reserves the right to limit mileage credit for an itinerary to the number of connecting flights actually traveled or the maximum number of segments shown in Delta's published schedule for a connection between any two cities, whichever is less.
But if you can get away with it... go for it!
------------------
AlphaSigOU
Causa latet vis est notissima - the cause is hidden, the results are well-known.