The robber struck at the William Hill shop in John Street, Penicuik, at about 7.50pm on Saturday.
The suspect pulled out a gun and demanded money before making off with a few hundred pounds. No-one was injured during the incident.
The man was described as white, 5ft 7in to 5ft 10in tall, slim build, wearing a thigh-length black zip-up hooded jacket with a reflective strip across the lower back, blue stone-wash jeans and white trainers.
Police said they were trying to track down anyone who may have witnessed what they described as a "very serious incident", and appealed for information from the public.
A police spokesman said: "We would be keen to speak to anyone who was in the area at the time, or who has any information about the robbery.