There are several causes of thinning hair, most of which are benign but some of which can require medical evaluation. The physicians who would be well qualified to discuss this issue with you include your primary care doctor
and your dermatologist
The most common cause of thinning hair is "pattern baldness" which can occur in men and women. In men it tends to begin as thinning at the corners and top, just as you describe, whereas in women it can also present more as a generalized thinning. Generally pattern baldness is genetic, although it may skip a generation or two. Occasionally, especially in women, in can be a sign of an underlying hormonal disorder.
Another cause of thinning hair is telogen effluvium, which is a generalized loss of hair, usually in the setting of a physical stress, such as a severe illness
or crash diet. A simple office test called the 'hair pull test' can be done by your physician to distinguish this from pattern baldness.
Occasionally, hair loss can also be caused by skin inflammations or infections, such as ringworm. This tends to be patchier in appearance however.
As always, the diagnosis and the management of your specific condition will require an examination by your personal physician. Scheduling an office visit with your primary care doctor or your dermatologist is highly recommended.